~soren/surveilr/client

« back to all changes in this revision

Viewing changes to surveilr/api/server.py

  • Committer: Tarmac
  • Author(s): Soren Hansen
  • Date: 2011-11-20 20:17:15 UTC
  • mfrom: (4.1.1 pep8-clean)
  • Revision ID: tarmac-20111120201715-in9uxpf99ngn2n22
PEP-8 and pyflakes clean

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
from surveilr import models
39
39
from surveilr import utils
40
40
 
 
41
 
41
42
class ServiceController(object):
42
43
    """Routes style controller for actions related to services"""
43
44
 
49
50
        data = json.loads(req.body)
50
51
        service = models.Service(**data)
51
52
        service.save()
52
 
        response = {'id':service.key}
 
53
        response = {'id': service.key}
53
54
        return Response(json.dumps(response))
54
55
 
55
56
    def show(self, req, id):
95
96
            retval += [{'metrics': x.metrics, 'timestamp': x.timestamp}]
96
97
        return Response(json.dumps(retval))
97
98
 
 
99
 
98
100
class SurveilrApplication(object):
99
101
    """The core Surveilr Monitoring WSGI application"""
100
102
    controllers = {}
126
128
 
127
129
application = SurveilrApplication()
128
130
 
 
131
 
129
132
def main():
130
133
    socket = eventlet.listen(('', 9877))
131
134
    eventlet.wsgi.server(socket, application)
132
135
 
133
 
if __name__ == '__main__': # pragma: nocover
 
136
 
 
137
if __name__ == '__main__':  # pragma: nocover
134
138
    main()