diff --git a/python/example-tinance2.py b/python/example-tinance2.py index d23e1b2..00d664c 100644 --- a/python/example-tinance2.py +++ b/python/example-tinance2.py @@ -26,7 +26,7 @@ HEADERS = { } # Define a maximum number of retry attempts and a delay between retries -MAX_RETRY_ATTEMPTS = 3 +MAX_RETRY_ATTEMPTS = 5 # Changed to 5 RETRY_DELAY_SECONDS = 10 def handle_log_msg(prefix, value): @@ -45,6 +45,10 @@ def send_http_request_with_retry(url, data, headers): elif reader_info.get("mode") == "TOGGLE": ser.write("toggle".encode('utf-8')) break # Successful request, no need to retry + elif response.status_code in [400, 401, 500]: + # Don't retry on certain errors + print(f"HTTP POST request failed with status code {response.status_code}. Not retrying.") + break else: print(f"Failed to send FULL_CARD_ID via HTTP POST. Status code: {response.status_code}") print(response.text)