requests: add breakout if response is not auth related, fix #28
This commit is contained in:
parent
690431472c
commit
77b4bd9700
@ -79,6 +79,8 @@ def get_sales_prognosis_data(
|
|||||||
_, status = session.relogin()
|
_, status = session.relogin()
|
||||||
if status != STATUS_HANDLER.SUCCESS and attempt == MAX_LOGIN_RETRIES:
|
if status != STATUS_HANDLER.SUCCESS and attempt == MAX_LOGIN_RETRIES:
|
||||||
return empty_response, status
|
return empty_response, status
|
||||||
|
continue
|
||||||
|
break
|
||||||
except requests.exceptions.Timeout:
|
except requests.exceptions.Timeout:
|
||||||
return empty_response, STATUS_HANDLER.pipe_states.CONNECTION_TIMEOUT
|
return empty_response, STATUS_HANDLER.pipe_states.CONNECTION_TIMEOUT
|
||||||
except requests.exceptions.RequestException:
|
except requests.exceptions.RequestException:
|
||||||
|
|||||||
@ -51,7 +51,7 @@ class KnownDelBarApiErrorCodes(enum.Enum):
|
|||||||
|
|
||||||
# ** API
|
# ** API
|
||||||
API_CON_TIMEOUT: Final[float] = 20.0 # secs to response
|
API_CON_TIMEOUT: Final[float] = 20.0 # secs to response
|
||||||
MAX_LOGIN_RETRIES: Final[int] = 1
|
MAX_LOGIN_RETRIES: Final[int] = 2
|
||||||
|
|
||||||
# ** API response parsing
|
# ** API response parsing
|
||||||
# ** column mapping [API-Response --> Target-Features]
|
# ** column mapping [API-Response --> Target-Features]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user