feat: wait for internet using httpx before continuing auth
Co-authored-by: aider (openai/gpt-5) <aider@aider.chat>
This commit is contained in:
@@ -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"],
|
||||||
|
|||||||
Reference in New Issue
Block a user