Skip to content

Commit

Permalink
fix error handling login
Browse files Browse the repository at this point in the history
  • Loading branch information
maxxrk committed Aug 5, 2024
1 parent 6059397 commit 5f7ee72
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

setuptools.setup(
name="vanguard-api",
version="0.2.1",
version="0.2.2",
author="MaxxRK",
author_email="[email protected]",
description="An unofficial API for Vanguard Invest",
long_description=long_description,
long_description_content_type="text/markdown",
license="MIT",
url="https://github.com/MaxxRK/vanguard-api",
download_url="https://github.com/MaxxRK/vanguard-api/archive/refs/tags/v0.2.0.tar.gz",
download_url="https://github.com/MaxxRK/vanguard-api/archive/refs/tags/v0.2.2.tar.gz",
keywords=["VANGUARD", "API"],
install_requires=["playwright", "playwright-stealth"],
packages=["vanguard"],
Expand Down
7 changes: 6 additions & 1 deletion vanguard/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,14 @@ def login(self, username, password, last_four):
"""
try:
self.password = password
self.go_url(login_page())
try:
self.go_url(login_page())
except PlaywrightTimeoutError:
self.close_browser()
raise Exception("Failed to load login page.")
login_state = self.find_login_state()
if login_state == 0:
self.close_browser()
raise Exception("Failed to find login state")
elif login_state == 1:
return False
Expand Down

0 comments on commit 5f7ee72

Please sign in to comment.