This line:
|
return resp.json(['error']) |
has bad construction should be:
return resp.json()['error']
but IMO this should be change to:
resp = requests.get(url)
if resp.status_code == 200:
return resp.json()
else:
error = resp.json()['error']
raise Exception(f"Web status: {resp.status_code} - {error}")