From bb29fcb25cf62c90f014216a67f089f83f28c9c9 Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Wed, 1 Sep 2021 19:26:58 +0200 Subject: [PATCH] chg: [api] md5 lookup updated to allow MD5 only records --- bin/server.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/server.py b/bin/server.py index a4c1b24..c81556c 100644 --- a/bin/server.py +++ b/bin/server.py @@ -100,8 +100,11 @@ class lookup(Resource): session_key = "session:{}:exist".format(request.headers.get('hashlookup_session')) rdb.sadd(session_key, k) rdb.expire(session_key, ttl) - sha1 = rdb.get("l:{}".format(k)) - h = rdb.hgetall("h:{}".format(sha1)) + if rdb.exist("h:{}".format(k)): + h = db.hgetall("h:{}".format(k)) + else: + sha1 = rdb.get("l:{}".format(k)) + h = rdb.hgetall("h:{}".format(sha1)) if "OpSystemCode" in h: if rdb.exists("h-OpSystemCode:{}".format(h['OpSystemCode'])): h['OpSystemCode'] = rdb.hgetall("h-OpSystemCode:{}".format(h['OpSystemCode']))