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
1 changed files with 4 additions and 1 deletions

View File

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