Skip to content

Commit

Permalink
Tweak comments
Browse files Browse the repository at this point in the history
  • Loading branch information
wvanhed committed Jan 5, 2024
1 parent 46b8ead commit 1a3948b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 2 additions & 0 deletions examples/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
print("\nExtendable loans are:")
extendable_loans = []
for _key, acc in info.items():
# Note: .extend(...) call below is standard Python functionality for lists
# It does NOT extend the loan(s)!
extendable_loans.extend([loan for loan in acc["loans"] if loan["extendable"]])
pp.pprint(extendable_loans)

Expand Down
7 changes: 2 additions & 5 deletions src/mijnbib/login_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,15 @@ def __init__(self, username, password, url: str, br: mechanize.Browser):
self._s.headers["Content-Type"] = "application/json"

def login(self) -> mechanize.Browser:
# TODO: check against documentation at https://mijn.bibliotheek.be/api-docs/openbibid-api.html
self._log_in()

# url = self._base_url + "/mijn-bibliotheek/lidmaatschappen"
# response = self._s.get(f"{url}", allow_redirects=False)
# html = response.text if response is not None else ""
# self._validate_logged_in(html)

# Transfer cookies from requests session to mechanize browser
self._br.set_cookiejar(self._s.cookies)
# for cookie in self._br._ua_handlers["_cookies"].cookiejar:
# print(cookie)

self._br.set_cookiejar(self._s.cookies) # Transfer from requests to mechanize session
return self._br

def _log_in(self):
Expand Down

0 comments on commit 1a3948b

Please sign in to comment.