returns events properly
This commit is contained in:
parent
6917406489
commit
296892a195
@ -52,9 +52,10 @@ def _initialize(enabled_versions, implementation_map):
|
|||||||
# ...
|
# ...
|
||||||
# /vN
|
# /vN
|
||||||
# resources here too.
|
# resources here too.
|
||||||
|
return api
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if True: # __name__ == '__main__':
|
||||||
# There may have been prior versions
|
# There may have been prior versions
|
||||||
# but they could be deprecated and dropped.
|
# but they could be deprecated and dropped.
|
||||||
# Only the versions specified here define
|
# Only the versions specified here define
|
||||||
@ -74,4 +75,5 @@ if __name__ == '__main__':
|
|||||||
# config = ...
|
# config = ...
|
||||||
# _load_implementations(impl_map, enabled_versions, config)
|
# _load_implementations(impl_map, enabled_versions, config)
|
||||||
|
|
||||||
_initialize(enabled_versions, impl_map)
|
api = _initialize(enabled_versions, impl_map)
|
||||||
|
|
||||||
|
@ -21,7 +21,8 @@ import common
|
|||||||
class EventCollection(common.FalconBase):
|
class EventCollection(common.FalconBase):
|
||||||
def on_get(self, req, resp):
|
def on_get(self, req, resp):
|
||||||
events = self.impl.get_events(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):
|
class EventItem(common.FalconBase):
|
||||||
|
@ -24,6 +24,12 @@ class Event(object):
|
|||||||
self.request_id = request_id
|
self.request_id = request_id
|
||||||
self.message_id = str(uuid.uuid4())
|
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):
|
class Impl(object):
|
||||||
def get_events(self, resp):
|
def get_events(self, resp):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user