♻️ Route HTTP calls through a central _request() helper #14
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refactor/central-request-helper"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Slice 1 of 2 — point #8 (session-expiry handling)
Behavior-preserving refactor that extracts the repeated
request → check 200 → return .json() / raise _api_errorpattern into a singleprivate
_request(self, method, path, **kwargs)helper. The 9 data-fetchingmethods now delegate to it (−61/+21 lines).
authenticate()andis_authenticated()intentionally keep their bespoke logicand do not route through
_request(login must never auto-retry; theauth-probe maps 401/403 →
False).Why: this unlocks the next slice (transparent auto re-auth on 401), which
wraps this single helper instead of touching all 12 methods.
Merge-safe: no behavior change, produced request URLs are byte-identical,
all 32 existing tests pass unchanged.
Draft (WIP) — remove the WIP prefix to mark ready for review.
WIP: ♻️ Route HTTP calls through a central _request() helperto ♻️ Route HTTP calls through a central _request() helper