From d640ba26a9a5f15d9ffff5e16fe73a75ce54bc12 Mon Sep 17 00:00:00 2001 From: Mark Eaton Date: Tue, 18 Nov 2025 09:30:30 -0500 Subject: [PATCH] feat: wait for internet using httpx before continuing auth Co-authored-by: aider (openai/gpt-5) --- main.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 66677c9..79b52ef 100644 --- a/main.py +++ b/main.py @@ -11,7 +11,16 @@ load_dotenv() def auth(): - sleep(180) + # 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: + break + except httpx.RequestError: + pass + print("Internet not available; retrying in 180 seconds...") + sleep(180) data = { "client_id": os.environ["CLIENT_ID"], "client_secret": os.environ["CLIENT_SECRET"],