Skip to content

Commit

Permalink
Prevent JSON decode error for unexpected response bodies from OVH APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
adferrand committed Oct 13, 2023
1 parent 221c6bb commit e4db692
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lexicon/_private/providers/ovh.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,8 @@ def _request(self, action="GET", url="/", data=None, query_params=None):
)
result.raise_for_status()

return result.json()
try:
return result.json()
except requests.exceptions.JSONDecodeError:
LOGGER.warning(f"Unexpected response from OVH APIs for {action} {url} (response dumped as plain text):\n{result.text}")
return None

0 comments on commit e4db692

Please sign in to comment.