fixed bug in post request

This commit is contained in:
Hellow2 2023-03-31 10:56:31 +02:00
parent 3aa6faab51
commit be48707623

View File

@ -67,12 +67,15 @@ class Page:
r = cls.API_SESSION.post(url, json=json, timeout=cls.TIMEOUT) r = cls.API_SESSION.post(url, json=json, timeout=cls.TIMEOUT)
except requests.exceptions.Timeout: except requests.exceptions.Timeout:
retry = True retry = True
except requests.exceptions.ConnectionError:
retry = True
if not retry and r.status_code in accepted_response_codes: if not retry and r.status_code in accepted_response_codes:
return r return r
LOGGER.warning(f"{cls.__name__} responded wit {r.status_code} at POST:{url}. ({trie}-{cls.TRIES})") if not retry:
LOGGER.debug(r.content) LOGGER.warning(f"{cls.__name__} responded wit {r.status_code} at POST:{url}. ({trie}-{cls.TRIES})")
LOGGER.debug(r.content)
if trie >= cls.TRIES: if trie >= cls.TRIES:
LOGGER.warning("to many tries. Aborting.") LOGGER.warning("to many tries. Aborting.")