-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use the created logger and not the root logger #34
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ __pycache__ | |
*.json | ||
cookies.txt | ||
.coverage | ||
.envrc | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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") | ||
Comment on lines
53
to
59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CODE REVIEWThe change from if login_link:
login_url = urljoin(res.url, login_link.get("href"))
else:
logger.debug(f"url: {res.url}, status: {res.status_code}") # Consider logging `res.text` conditionally or securely.
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") | ||
Comment on lines
64
to
70
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CODE REVIEWThe change from Example: # Ensure `logger` is set up correctly
logger.setLevel(logging.DEBUG)
# When logging responses, avoid logging sensitive information
logger.debug(f"url: {res.url}, status: {res.status_code}") |
||
|
@@ -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") | ||
Comment on lines
79
to
85
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CODE REVIEWGood job updating from if not self.is_logged_in:
logger.debug(f"url: {res.url}, status: {res.status_code}")
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 {} | ||
|
||
|
||
Comment on lines
194
to
200
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CODE REVIEWThe update from try:
with open(cookiefile, "r") as f:
return json.load(f)
except (FileNotFoundError, json.decoder.JSONDecodeError) as e:
logger.debug(f"Error reading cookies from {cookiefile}: {e}")
# Potentially consider a more user-friendly error strategy here
return {} |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CODE REVIEW
It appears you've added
.envrc
which is useful for environment variable management but this type of file should not be part of the version control to avoid accidentally exposing sensitive information. Consider adding.envrc
to your.gitignore
to prevent it from being tracked. Here's how you can do it: