Skip to content

Commit

Permalink
Use the created logger and not the root logger
Browse files Browse the repository at this point in the history
  • Loading branch information
madeddie committed May 14, 2024
1 parent 63f2c3d commit a6f6c18
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ __pycache__
*.json
cookies.txt
.coverage
.envrc
8 changes: 4 additions & 4 deletions moocfi_cses.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand All @@ -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")
Expand Down Expand Up @@ -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 {}


Expand Down

0 comments on commit a6f6c18

Please sign in to comment.