From 71fea8f6aadecae0ffe40028ebcbd620760543ba Mon Sep 17 00:00:00 2001 From: Hirusha Adikari <36286877+hirusha-adi@users.noreply.github.com> Date: Wed, 13 Apr 2022 20:18:05 +0530 Subject: [PATCH] login error handling --- app.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 89fe0e7..bfc6be1 100644 --- a/app.py +++ b/app.py @@ -50,7 +50,19 @@ def pip_install(name: str): # Login print("Please wait while logging in!") -obj.login(username=Database.USERNAME, password=Database.PASSWORD) +try: + obj.login(username=Database.USERNAME, password=Database.PASSWORD) +except: + login_username = input("Enter login username> ") + login_password = input("Enter login password> ") + try: + obj.login(username=login_username, password=login_password) + except: + continue_yn = input("[!!] Login Failed! Do you want to exit [y/n] >") + if continue_yn.lower() in ("yes", "y", "yeah", "ye", "true", "t"): + pass + else: + sys.exit("Quitting! Have a nice day!") print("Logged in successfully!")