Improve robustness: surround the 'id' fetch from result array with a try clause.

This commit is contained in:
MrLolEthan 2015-04-07 21:09:32 -02:30
parent d1ee9b7696
commit ec6099421b

View File

@ -33,6 +33,9 @@ class UsernameToUUID:
return "" return ""
json_data = json.loads(response) json_data = json.loads(response)
uuid = json_data['id'] try:
uuid = json_data['id']
except KeyError as e:
print("KeyError raised:", e);
return uuid return uuid