From 77b4bd97000547c2edec07e3dfd2b97153d76eb6 Mon Sep 17 00:00:00 2001 From: foefl Date: Wed, 30 Apr 2025 14:54:31 +0200 Subject: [PATCH] requests: add breakout if response is not auth related, fix #28 --- src/delta_barth/api/requests.py | 2 ++ src/delta_barth/constants.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/delta_barth/api/requests.py b/src/delta_barth/api/requests.py index a29c5d1..57b36a0 100644 --- a/src/delta_barth/api/requests.py +++ b/src/delta_barth/api/requests.py @@ -79,6 +79,8 @@ def get_sales_prognosis_data( _, status = session.relogin() if status != STATUS_HANDLER.SUCCESS and attempt == MAX_LOGIN_RETRIES: return empty_response, status + continue + break except requests.exceptions.Timeout: return empty_response, STATUS_HANDLER.pipe_states.CONNECTION_TIMEOUT except requests.exceptions.RequestException: diff --git a/src/delta_barth/constants.py b/src/delta_barth/constants.py index 4166daf..10fec1c 100644 --- a/src/delta_barth/constants.py +++ b/src/delta_barth/constants.py @@ -51,7 +51,7 @@ class KnownDelBarApiErrorCodes(enum.Enum): # ** API 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 # ** column mapping [API-Response --> Target-Features]