1
0
Fork 0

handle get_data exceptions better

Makes exception handling more precise, only raising status for 401s.

Also fixes a string pylint was complaining about.
This commit is contained in:
Hugh Rundle 2023-01-20 19:55:38 +11:00
parent f8c9df4aff
commit e8452011f7
2 changed files with 7 additions and 2 deletions

View file

@ -244,7 +244,11 @@ def get_data(url, params=None, timeout=settings.QUERY_TIMEOUT):
raise ConnectorException(err)
if not resp.ok:
resp.raise_for_status()
if resp.status_code == 401:
# this is probably an AUTHORIZED_FETCH issue
resp.raise_for_status()
else:
raise ConnectorException()
try:
data = resp.json()
except ValueError as err: