From 0d145cac5b0789550e9453faeb24dce45c66a28b Mon Sep 17 00:00:00 2001 From: "Laptop-Ward-o2o\\Ward" Date: Wed, 10 Jan 2024 15:23:19 +0100 Subject: [PATCH] Add troubleshooting info to warning log --- src/mijnbib/login_handlers.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/mijnbib/login_handlers.py b/src/mijnbib/login_handlers.py index 12e3cbb..930fca8 100644 --- a/src/mijnbib/login_handlers.py +++ b/src/mijnbib/login_handlers.py @@ -172,12 +172,19 @@ def _log_in(self): _log.debug(f"login (4) cookies : {response.cookies}") # _log.debug(f"login (4) text : {response.text}") + # Note: the above request gives a 302 redirection, but we don't follow it (too costly) + # Soft verification if we are logged in if ("mijn-bibliotheek/overzicht" not in response.headers.get("location", "")) and ( "mijn-bibliotheek/lidmaatschappen" not in response.headers.get("location", "") ): _log.warning( - "Not clear if properly logged in. Was expecting " + f"Not clear if properly logged in (as '{self._username}'). Was expecting " "'mijn-bibliotheek/overzicht' or 'mijn-bibliotheek/lidmaatschappen' " "in location header, but couldn't find it" ) + _log.warning( + "Related troubleshooting info. " + f"Status code: '{response.status_code}'. " + f"Headers: '{response.headers}'" + )