Skip to content

feat: add per-client HTTPX adapters - #191

Draft
parvahuja wants to merge 1 commit into
parv/sync-payment-transport-v0.13from
parv/httpx-client-adapters-v0.14
Draft

feat: add per-client HTTPX adapters#191
parvahuja wants to merge 1 commit into
parv/sync-payment-transport-v0.13from
parv/httpx-client-adapters-v0.14

Conversation

@parvahuja

@parvahuja parvahuja commented Jul 28, 2026

Copy link
Copy Markdown
Member

Runtime stack 4 of 5 · depends on #190 · next: #192

Summary

  • add wrap_client() and wrap_async_client() for existing HTTPX instances
  • preserve configured transports, auth, redirects, cookies, hooks, streaming, and send callables cached before adaptation
  • enforce one payment across each complete HTTPX auth/redirect flow
  • fail before mutation on unsupported HTTPX versions or adapter seams
  • roll back partial client mutation transactionally

Review boundary

Explicit per-client opt-in only. Each client keeps one payment transport, and one nested-safe context variable spans HTTPX auth and redirect flows. The adapter patches _send_handling_auth and _send_single_request; it does not patch the public send method. Wrap clients before concurrent use.

Compatibility

Supported and tested: HTTPX 0.27.x and 0.28.x.

Validation

  • full suite: 925 passed, 41 skipped
  • adapter suite: 26 passed on HTTPX 0.27.0 and 0.28.1
  • cached bound sends, custom multi-request auth, redirects, nested hooks, request reuse, cancellation, and uncertain-outcome smokes
  • Ruff, formatting, and Pyright pass

@parvahuja
parvahuja force-pushed the parv/httpx-client-adapters-v0.14 branch from 48fa4f6 to 247c2ac Compare July 28, 2026 18:26
@parvahuja
parvahuja force-pushed the parv/httpx-client-adapters-v0.14 branch from 247c2ac to 2a120e8 Compare July 28, 2026 23:25
@parvahuja
parvahuja force-pushed the parv/httpx-client-adapters-v0.14 branch from 2a120e8 to c821796 Compare July 29, 2026 00:43
@parvahuja
parvahuja force-pushed the parv/httpx-client-adapters-v0.14 branch 2 times, most recently from 79739ad to d9a6e31 Compare July 29, 2026 03:33
@parvahuja
parvahuja force-pushed the parv/httpx-client-adapters-v0.14 branch from d9a6e31 to 5bd7a18 Compare July 29, 2026 03:43
@parvahuja
parvahuja force-pushed the parv/httpx-client-adapters-v0.14 branch from 5bd7a18 to 6c1bc6f Compare July 29, 2026 03:50
@parvahuja
parvahuja force-pushed the parv/httpx-client-adapters-v0.14 branch from 6c1bc6f to 218e76b Compare July 29, 2026 19:25
@parvahuja
parvahuja force-pushed the parv/httpx-client-adapters-v0.14 branch from 218e76b to 7e2713d Compare July 29, 2026 21:04
@parvahuja
parvahuja force-pushed the parv/httpx-client-adapters-v0.14 branch from 7e2713d to 71036a5 Compare July 29, 2026 21:49
@parvahuja
parvahuja force-pushed the parv/httpx-client-adapters-v0.14 branch from 71036a5 to 775f6dd Compare July 30, 2026 18:01
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