Repository navigation
feat: Handle situations when server is not returning JSON response - #417
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #417 +/- ##
==========================================
+ Coverage 66.03% 70.01% +3.98%
==========================================
Files 2 2
Lines 630 697 +67
==========================================
+ Hits 416 488 +72
+ Misses 214 209 -5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Improve error handling, retry logic, and exception naming
Builds on the existing JSON error handling to add full retry support, consistent exception naming, and reduced complexity in _query.
Exception renaming
All exceptions prefixed with
Wikito avoid shadowing Python built-ins (PYL-W0622): WikiHttpError, WikiRateLimitError, WikiHttpTimeoutError, WikiInvalidJsonError, WikiConnectionError.Retry logic
_query previously made a single unguarded request. It now retries transient errors (429, 5xx, timeouts, connection errors) with exponential backoff, honours
Retry-After, and raises immediately for non-retryable errors. Controlled by new Wikipedia(max_retries=3, retry_wait=1.0) constructor parameters._query refactor
Cyclomatic complexity reduced from 18 to low by extracting two helpers: _attempt_request (one HTTP GET, converts
requestsexceptions) and _handle_response (status code dispatch). _query is now a thin retry loop.Also
:raises:entries