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"],