From f67dc7ea2093fcbc83f1ab8d8877ad9eb58979f2 Mon Sep 17 00:00:00 2001 From: Stuart Longland Date: Tue, 27 Nov 2018 21:15:42 +1000 Subject: [PATCH] server: Emit scores with hash value. We'll ultimately be using this as another trait to classify users by (whether the avatar has been seen before). The UI will therefore need this information. --- hadsh/server.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hadsh/server.py b/hadsh/server.py index 5164e18..312305f 100644 --- a/hadsh/server.py +++ b/hadsh/server.py @@ -242,8 +242,14 @@ class AvatarHashHandler(AuthRequestHandler): db.commit() self.set_status(200) - self.set_header('Content-Type', 'text/plain') - self.write(avatar_hash.hashstr) + self.set_header('Content-Type', 'application/json') + self.write(json.dumps({ + 'id': avatar_hash.hash_id, + 'algo': avatar_hash.hashalgo, + 'hash': avatar_hash.hashstr.decode(), + 'score': avatar_hash.score, + 'count': avatar_hash.count + })) self.finish() finally: db.close()