Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3 from MaKraMc/dev-loginfix
Browse files Browse the repository at this point in the history
login improvements for edge cases
  • Loading branch information
MaKraMc authored May 11, 2024
2 parents 6b7b3d6 + 5670261 commit ec166c4
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@ def login(driver, platform):
except:
print("Error\nCould not load the page. Retrying...")
return False

print("Done")
#Load the environment variables

#If we previously attempted to login, we might already be logged in
if not re.search(r'login', driver.current_url):
print("Already logged in!")
return True

#Load the environment variables
WDCUsername=getenv("WDCUsername")
WDCPassword=getenv("WDCPassword")

Expand Down Expand Up @@ -109,7 +114,11 @@ def login(driver, platform):

#Check if we got redirected. If not, we failed to login
if re.search(r'login', driver.current_url):
#Maybe there is hope if we manually navigate to the quantify page
#In some weird cases, login seems to fail while still generating a valid session
#In this case we have to go to the main page and then to the personal page
print("Checking login")
driver.get(f'https://{platform}/index.html')
sleep(3)
driver.get(f'https://{platform}/index.html/pc.html#/basic')
sleep(3)
if re.search(r'login', driver.current_url):
Expand Down

0 comments on commit ec166c4

Please sign in to comment.