From 41f2cbc031745318be5ea22f50033c112abd493b Mon Sep 17 00:00:00 2001 From: eviltr0n Date: Wed, 28 Aug 2024 00:10:13 +0530 Subject: [PATCH] chatgpt login error handled --- internshala_bot/main.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/internshala_bot/main.py b/internshala_bot/main.py index e20134b..4032f59 100644 --- a/internshala_bot/main.py +++ b/internshala_bot/main.py @@ -80,7 +80,15 @@ def login_internshala(self): def login_chat_gpt(self): page = self.browser.new_page() - page.goto('https://chat.openai.com' , timeout=60000, wait_until='networkidle') + try: + page.goto('https://chat.openai.com' , timeout=30000, wait_until='networkidle') + except TimeoutError as e: + print("[red]TimeOut while loading ChatGPT webpage... Trying Again[/]") + try: + page.goto('https://chat.openai.com' , timeout=30000, wait_until='networkidle') + except TimeoutError as e: + print('\n[bold red]Timeout Occured while loading https://chatgpt.com, Please check your network and Try again.\n[/]') + exit() time.sleep(1) try: with page.expect_navigation():