do not treat failed requests as erros in site_api

This commit is contained in:
Maximilian Keßler 2023-07-07 14:19:57 +02:00
parent 301cfe10e8
commit fb645b47b4
Signed by: max
GPG Key ID: BCC5A619923C0BA5
1 changed files with 2 additions and 2 deletions

View File

@ -22,10 +22,10 @@ def get(url, refresh=False) -> Optional[Dict | str]:
logger.debug("GET {} (force_refresh={})".format(query, refresh))
response = session.get(query, force_refresh=refresh)
if not response:
logger.error("Failed to get request {} from".format(query))
logger.debug("Failed to get request {} from".format(query))
return None
if not response.status_code == 200:
logger.error("Request {} from produced status code {}".format(query, response.status_code))
logger.debug("Request {} from produced status code {}".format(query, response.status_code))
return None
if "application/json" in response.headers['content-type']:
return json.loads(response.text)