Skip to content

Commit

Permalink
fix: JSONDecodeError for status code 429. (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcarnero97 authored Sep 3, 2024
1 parent 5e52542 commit a15f6b7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion datadis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,8 @@ async def _request(
result.append(dict_to_typed(contract, output_type))
return result
else:
raise ConnectionError(f'Error: {r.json()["message"]}')
try:
message = r.json()["message"]
except Exception as e:
raise ConnectionError(f'Unknown error', dict(status_code=r.status_code, content=r.text, headers=r.headers)) from e
raise ConnectionError(f'Error: {message}')

0 comments on commit a15f6b7

Please sign in to comment.