feat: wait for internet using httpx before continuing auth

Co-authored-by: aider (openai/gpt-5) <aider@aider.chat>
This commit is contained in:
Mark Eaton
2025-11-18 09:30:30 -05:00
co-authored by aider
parent 56ca698031
commit d640ba26a9
+10 -1
View File
@@ -11,7 +11,16 @@ load_dotenv()
def auth(): 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 = { data = {
"client_id": os.environ["CLIENT_ID"], "client_id": os.environ["CLIENT_ID"],
"client_secret": os.environ["CLIENT_SECRET"], "client_secret": os.environ["CLIENT_SECRET"],