summaryrefslogtreecommitdiff
path: root/src/wsgi.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/wsgi.py')
-rwxr-xr-xsrc/wsgi.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/wsgi.py b/src/wsgi.py
index 2728d23..62db3c9 100755
--- a/src/wsgi.py
+++ b/src/wsgi.py
@@ -46,7 +46,7 @@ class CollectorResource():
class EPGet(CollectorResource):
- def on_get(self, req, resp):
+ def on_get(self, req, resp, key=None):
out = list()
selectors = dict()
@@ -60,6 +60,11 @@ class EPGet(CollectorResource):
{'status': 'error', 'message': 'Invalid username or password\n'})
return
+ if key:
+ out = self._db.get(key)
+ resp.text = json.dumps({'status': 'success', 'data': out})
+ return
+
for param in req.params:
for i in index.indexes:
for j in i['index']['fields']:
@@ -131,7 +136,8 @@ def main(port=8000, wsgi_helper=False):
users = authn.UserDB('wsgi_demo_users.yaml')
resources_map = [
('/sc/v0/add', EPAdd(db, users)),
- ('/sc/v0/get', EPGet(db, users))
+ ('/sc/v0/get', EPGet(db, users)),
+ ('/sc/v0/get/{key}', EPGet(db, users))
]
app = falcon.App(cors_enable=True)