Repository navigation
refactor: migrate whisparr + eros to shared arr_client - #101
Merged
Merged
Conversation
Migrates the final two app modules onto the shared *Arr HTTP client
(T6d, completing the refactor series):
- whisparr/api.py (Whisparr v2): arr_request() becomes a thin wrapper
delegating to src/primary/utils/arr_client.py with api_prefix="v3".
Signature unchanged. The /api/v3/-only path note is preserved in the
delegation comment.
- eros/api.py (Whisparr v3): arr_request() becomes a thin wrapper
delegating with api_prefix="v3". Signature unchanged.
- session is re-exported from arr_client (same object) in both modules
so existing patch.object(<app>_api.session, ...) tests still
intercept requests made by the shared client.
- get_ssl_verify_setting() is resolved in the app module namespace and
passed via ssl_verify= so existing test monkeypatches keep working.
Behavior notes:
- Whisparr/Eros requests now send User-Agent "Seekarr/<running version>"
(from version.txt) instead of the hardcoded "Seekarr/7.0.0".
- Both gain the shared client's detailed HTTP-error logging (status code
+ response snippet) and JSON-decode failure logging; the old variants
logged a bare "Request failed: {e}".
This completes the shared-client migration: all six *Arr app modules
(sonarr, radarr, lidarr, readarr, whisparr, eros) now delegate to
src/primary/utils/arr_client.py. No app module creates its own
requests.Session() anymore, and no hardcoded User-Agent remains in src/.
Tests: whisparr/eros tests needed no changes (they already patched
per-method session.get/post). 4 new regression tests pin
shared-session identity and the shared User-Agent source.
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.
Summary
Migrates the final two app modules onto the shared *Arr HTTP client — completing the refactor series started in #98.
whisparr/api.py(Whisparr v2):arr_request()is now a thin wrapper delegating withapi_prefix="v3", signature unchanged. The "/api/v3/ is the only path" note is preserved in the delegation comment.eros/api.py(Whisparr v3):arr_request()is now a thin wrapper delegating withapi_prefix="v3", signature unchanged.sessionis re-exported fromarr_client(same object) in both modules, sopatch.object(<app>_api.session, …)tests still intercept requests made by the shared client.get_ssl_verify_setting()is resolved in the app module namespace and passed viassl_verify=, so existing test monkeypatches keep working.Behavior notes
User-Agent: Seekarr/<version.txt>Seekarr/7.0.0Request failed: {e}End state of the series
All six *Arr app modules (sonarr, radarr, lidarr, readarr, whisparr, eros) now delegate to
src/primary/utils/arr_client.py:requests.Session()anymoreUser-Agentremains insrc/version.txt, written bypublish.ymlat build time)Tests
session.get/post).ruff check src/clean.