returns events properly
This commit is contained in:
parent
6917406489
commit
296892a195
@ -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)
|
||||
|
||||
|
@ -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):
|
||||
|
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user