diff --git a/quincy/api.py b/quincy/api.py index 8e35b4a..debc0d3 100644 --- a/quincy/api.py +++ b/quincy/api.py @@ -52,9 +52,10 @@ def _initialize(enabled_versions, implementation_map): # ... # /vN # resources here too. + return api -if __name__ == '__main__': +if True: # __name__ == '__main__': # There may have been prior versions # but they could be deprecated and dropped. # Only the versions specified here define @@ -74,4 +75,5 @@ if __name__ == '__main__': # config = ... # _load_implementations(impl_map, enabled_versions, config) - _initialize(enabled_versions, impl_map) + api = _initialize(enabled_versions, impl_map) + diff --git a/quincy/v1_api.py b/quincy/v1_api.py index 2ee2e3e..dd7b9df 100644 --- a/quincy/v1_api.py +++ b/quincy/v1_api.py @@ -21,7 +21,8 @@ import common class EventCollection(common.FalconBase): def on_get(self, req, resp): events = self.impl.get_events(resp) - resp.body = json.dumps(event) + dicts = [event.to_dict() for event in events] + resp.body = json.dumps(dicts) class EventItem(common.FalconBase): diff --git a/quincy/v1_impl.py b/quincy/v1_impl.py index fbdb628..54021f5 100644 --- a/quincy/v1_impl.py +++ b/quincy/v1_impl.py @@ -24,6 +24,12 @@ class Event(object): self.request_id = request_id self.message_id = str(uuid.uuid4()) + def to_dict(self): + return {"when": str(self.when), + "name": self.name, + "request_id": self.request_id, + "message_id": self.message_id} + class Impl(object): def get_events(self, resp):