Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR improves error handling for API requests and enhances user experience by adding request timeout configuration and better error messaging.
- Add error handling decorator for HTTP requests with user-friendly messages
- Reduce default timeout to 5 seconds for better responsiveness
- Add comprehensive test coverage for parser functions with test data fixtures
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| leak/utils.py | Introduces new error handling decorator and context manager utilities |
| leak/main.py | Applies error handling decorator to API functions and adds timeout configuration |
| leak/settings.py | Adds REQUESTS_TIMEOUT configuration setting |
| leak/parser.py | Refactors email/author parsing with improved shared email handling |
| tests/test_parser.py | Adds comprehensive test cases for parser functions |
| tests/conftest.py | Adds test fixtures for package and download data |
| tests/data/aiohttp_package_data.json | Test data for parser function validation |
| pyproject.toml | Version bump and dependency updates |
| .pre-commit-config.yaml | Updates pre-commit hook versions |
| leak/ui.py | Removes debug print statement |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Comment on lines
+63
to
+67
| author = author_line | ||
| if all(parsed): | ||
| author = parsed[0] | ||
|
|
||
| return decode_name(author) |
There was a problem hiding this comment.
The function calls decode_name(author) but author could be the original author_line string when all(parsed) is False. The decode_name function expects email header encoded data, but author_line might not be encoded, causing potential decoding errors.
Suggested change
| author = author_line | |
| if all(parsed): | |
| author = parsed[0] | |
| return decode_name(author) | |
| if all(parsed): | |
| return decode_name(parsed[0]) | |
| else: | |
| return author_line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description