Skip to content

Commit

Permalink
Speed up form login
Browse files Browse the repository at this point in the history
  • Loading branch information
wvanhed committed Jan 5, 2024
1 parent 636cd0b commit ec14395
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/mijnbib/login_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def __init__(self, username, password, url: str, br: mechanize.Browser):
self._br = br

def login(self) -> mechanize.Browser:
# TODO: check if can be sped up by starting from lidmaatschappen page (and not overview)
response = self._log_in()
html = response.read().decode("utf-8") if response is not None else ""
self._validate_logged_in(html) # raises AuthenticationError if not ok
Expand Down
7 changes: 6 additions & 1 deletion src/mijnbib/mijnbibliotheek.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ def login(self) -> None:
CanNotConnectError
IncompatibleSourceError
"""
url = self.BASE_URL + "/mijn-bibliotheek/aanmelden"
url = (
self.BASE_URL
+ "/mijn-bibliotheek/aanmelden"
# loads considerably faster than default "/overzicht" page, especially for cold cache
+ "?destination=/mijn-bibliotheek/lidmaatschappen"
)
_log.info(f"Will log in at url : {url}")
_log.info(f" with id : {self._username}")

Expand Down

0 comments on commit ec14395

Please sign in to comment.