From a6f6c1879c25186762b941c6a34bb28d7a6652d7 Mon Sep 17 00:00:00 2001 From: Edwin Hermans Date: Tue, 14 May 2024 09:44:51 -0400 Subject: [PATCH] Use the created logger and not the root logger --- .gitignore | 1 + moocfi_cses.py | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 564d342..b1b7370 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ __pycache__ *.json cookies.txt .coverage +.envrc diff --git a/moocfi_cses.py b/moocfi_cses.py index 7d4ca98..2316afb 100644 --- a/moocfi_cses.py +++ b/moocfi_cses.py @@ -53,7 +53,7 @@ def login(self) -> None: if login_link: login_url = urljoin(res.url, login_link.get("href")) else: - logging.debug( + logger.debug( f"url: {res.url}, status: {res.status_code}\nhtml:\n{res.text}" ) raise ValueError("Failed to find login url") @@ -64,7 +64,7 @@ def login(self) -> None: action = login_form.get("_action") login_form.pop("_action") else: - logging.debug( + logger.debug( f"url: {res.url}, status: {res.status_code}\nhtml:\n{res.text}" ) raise ValueError("Failed to find login form") @@ -79,7 +79,7 @@ def login(self) -> None: ) if not self.is_logged_in: - logging.debug( + logger.debug( f"url: {res.url}, status: {res.status_code}\nhtml:\n{res.text}" ) raise ValueError("Login failed") @@ -194,7 +194,7 @@ def read_cookie_file(cookiefile: str) -> dict[str, str]: with open(cookiefile, "r") as f: return json.load(f) except (FileNotFoundError, json.decoder.JSONDecodeError) as e: - logging.debug(f"Error reading cookies from {cookiefile}: {e}") + logger.debug(f"Error reading cookies from {cookiefile}: {e}") return {}