Skip to content

refactor: migrate whisparr + eros to shared arr_client - #101

Merged
jeblankenship merged 1 commit into
mainfrom
refactor-arr-client-whisparr-eros
Oct 16, 2026
Merged

jeblankenship merged 1 commit into
mainfrom
refactor-arr-client-whisparr-eros

Conversation

@jeblankenship

Copy link
Copy Markdown
Collaborator

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 with api_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 with api_prefix="v3", signature unchanged.
  • session is re-exported from arr_client (same object) in both modules, so 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

Change Impact
Whisparr/Eros send User-Agent: Seekarr/<version.txt> replaces stale hardcoded Seekarr/7.0.0
Detailed HTTP-error logging (status code + response snippet) old variants logged a bare Request 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:

  • No app module creates its own requests.Session() anymore
  • No hardcoded User-Agent remains in src/
  • One shared session (connection pooling across all apps)
  • Single version source for the UA (version.txt, written by publish.yml at build time)

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.
  • Full suite: 747 passed. ruff check src/ clean.

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.
@jeblankenship
jeblankenship merged commit f795d18 into main Oct 16, 2026
3 checks passed
@jeblankenship
jeblankenship deleted the refactor-arr-client-whisparr-eros branch October 16, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant