From a93a8b5fc85e7bb53df07a8ece2adcfa270f04fa Mon Sep 17 00:00:00 2001 From: Mark Eaton Date: Tue, 18 Nov 2025 09:39:13 -0500 Subject: [PATCH] improve network connectivity check --- .python-version | 1 + main.py | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 .python-version diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..24ee5b1 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.13 diff --git a/main.py b/main.py index 79b52ef..bc7fb28 100644 --- a/main.py +++ b/main.py @@ -14,12 +14,12 @@ def auth(): # Wait for internet connectivity before proceeding while True: try: - resp = httpx.get("https://www.google.com", timeout=5.0) - if 200 <= resp.status_code < 400: + test = httpx.get("https://www.google.com", timeout=5.0) + if 200 <= test.status_code < 400: break - except httpx.RequestError: - pass - print("Internet not available; retrying in 180 seconds...") + except: + print(test.status_code) + print("Internet not available; retrying in 180 seconds...") sleep(180) data = { "client_id": os.environ["CLIENT_ID"],