chg: [server] query logging added

pull/1/head
Alexandre Dulaunoy 2020-01-07 11:00:18 +01:00
parent ef4660a92d
commit a8de744ca1
No known key found for this signature in database
GPG Key ID: 09E2CD4944E6CBCD
1 changed files with 2 additions and 2 deletions

View File

@ -17,6 +17,7 @@ class Query(tornado.web.RequestHandler):
query = json_decode(self.request.body)
if not ('uuid' in query or 'name' in query):
return self.write(json.dumps("'error': 'Incorrect query format'"))
user_agent = self.request.headers["User-Agent"]
if 'uuid' in query:
if query['uuid'] in tai_full:
result = tai_full[query['uuid']]
@ -29,6 +30,7 @@ class Query(tornado.web.RequestHandler):
for uuid in tai_names[query['name'].lower()]:
result = []
result.append(tai_full[uuid])
print("Query {} from {}".format(query, user_agent))
return self.write("{}".format(json.dumps(result)))
class Get(tornado.web.RequestHandler):
@ -76,5 +78,3 @@ if __name__ == "__main__":
application.listen(8889)
tornado.ioloop.IOLoop.instance().start()