From 1b31fe85047d6670aab79966a420524093d71621 Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Mon, 24 May 2021 17:07:43 +0200 Subject: [PATCH] chg: [server] return CyCAT object type in JSON output --- backend/bin/server.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/bin/server.py b/backend/bin/server.py index 51d2fba..c2e6a9a 100644 --- a/backend/bin/server.py +++ b/backend/bin/server.py @@ -10,7 +10,7 @@ api = Api(app, version=version, title='CyCAT.org API', description='CyCAT - The import uuid import inspect import redis - +cycat_type = {"1": "Publisher", "2": "Project"} r = redis.Redis(host='127.0.0.1', port='3033', decode_responses=True) @@ -77,6 +77,7 @@ class lookup(Resource): return{'message': 'Non existing UUID'}, 404 t = r.get("u:{}".format(uuid)) h = r.hgetall("{}:{}".format(t, uuid)) + h['_cycat_type'] = cycat_type[str(t)] return (h) else: return {'message': 'UUID is incorrect'}, 400