From 2c749d257f1598327f336e662d9875fcdaec9a0c Mon Sep 17 00:00:00 2001 From: Edwin Hermans Date: Thu, 9 May 2024 12:01:05 -0400 Subject: [PATCH] Add debug logs for the login method --- moocfi_cses.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/moocfi_cses.py b/moocfi_cses.py index be1b053..f81dfd9 100644 --- a/moocfi_cses.py +++ b/moocfi_cses.py @@ -62,6 +62,7 @@ def login(self) -> None: if login_link: login_url = urllib.parse.urljoin(res.url, login_link.get("href")) else: + logging.debug(f"url: {res.url}, status: {res.status_code}\nhtml:\n{res.text}") raise ValueError("Failed to find login url") res = self.http_session.get(login_url, headers={"referer": res.url}) @@ -70,6 +71,7 @@ def login(self) -> None: action = login_form.get("_action") login_form.pop("_action") else: + logging.debug(f"url: {res.url}, status: {res.status_code}\nhtml:\n{res.text}") raise ValueError("Failed to find login form") login_form["session[login]"] = self.username @@ -82,6 +84,7 @@ def login(self) -> None: ) if not self.is_logged_in: + logging.debug(f"url: {res.url}, status: {res.status_code}\nhtml:\n{res.text}") raise ValueError("Login failed") def http_request(