chg: [tai-server] proper handling for non-existing threat-actor in queried country

pull/2/head
Alexandre Dulaunoy 2020-05-29 11:44:20 +02:00
parent 9fa0047294
commit 1153d5cd17
No known key found for this signature in database
GPG Key ID: 09E2CD4944E6CBCD
1 changed files with 8 additions and 4 deletions

View File

@ -32,13 +32,17 @@ class Query(tornado.web.RequestHandler):
for uuid in tai_names[query['name'].lower()]:
result.append(tai_full[uuid])
if 'country' in query:
ta = tai_country[query['country'].lower()]
result = []
for uuid in tai_country[query['country'].lower()]:
result.append(tai_full[uuid])
if query['country'].lower() in tai_country:
ta = tai_country[query['country'].lower()]
result = []
for uuid in tai_country[query['country'].lower()]:
result.append(tai_full[uuid])
else:
result = {'error': 'Not existing country in the MISP galaxy threat-actor'}
print("Query {} from {}".format(query, user_agent))
return self.write("{}".format(json.dumps(result)))
class Get(tornado.web.RequestHandler):
def prepare(self):