Improve robustness: surround the 'id' fetch from result array with a try clause.
This commit is contained in:
parent
d1ee9b7696
commit
ec6099421b
@ -33,6 +33,9 @@ class UsernameToUUID:
|
||||
return ""
|
||||
|
||||
json_data = json.loads(response)
|
||||
try:
|
||||
uuid = json_data['id']
|
||||
except KeyError as e:
|
||||
print("KeyError raised:", e);
|
||||
|
||||
return uuid
|
||||
|
Loading…
Reference in New Issue
Block a user