From fe04f1e7dd1ca69cab70fd4afcdbdaddf0a4b3e6 Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Wed, 1 Sep 2021 19:37:21 +0200 Subject: [PATCH] chg: [api/md5] data sources with MD5 only hashes --- bin/server.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/server.py b/bin/server.py index c81556c..548828c 100644 --- a/bin/server.py +++ b/bin/server.py @@ -82,7 +82,7 @@ class lookup(Resource): ttl = False if session: ttl = get_session() - if not rdb.exists("l:{}".format(k)): + if not (rdb.exists("l:{}".format(k)) or rdb.exists("h:{}".format(k))): if stats: rdb.zincrby("s:nx:md5", score, k) if stats_pubsub: @@ -100,8 +100,9 @@ class lookup(Resource): session_key = "session:{}:exist".format(request.headers.get('hashlookup_session')) rdb.sadd(session_key, k) rdb.expire(session_key, ttl) - if rdb.exist("h:{}".format(k)): - h = db.hgetall("h:{}".format(k)) + if rdb.exists("h:{}".format(k)): + h = rdb.hgetall("h:{}".format(k)) + sha1 = k else: sha1 = rdb.get("l:{}".format(k)) h = rdb.hgetall("h:{}".format(sha1))