Skip to content

docs: Document the transport-hook contract and the built-in HTTPX client - #1013

Open
vdusek wants to merge 7 commits into
masterfrom
docs-custom-http-client-guide
Open

docs: Document the transport-hook contract and the built-in HTTPX client#1013
vdusek wants to merge 7 commits into
masterfrom
docs-custom-http-client-guide

Conversation

@vdusek

@vdusek vdusek commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Rewrites the HTTP clients concepts page around the three-layer hierarchy and the transport hooks, documents the built-in HTTPX client from #1004 (installation, sync/async examples, timeout semantics), and replaces the old HTTPX guide with "Build a custom HTTP client", which implements full AIOHTTP and requests clients including response adapters for the HttpResponse protocol.

Stack: #1022 (pipeline) → #1004 (HTTPX client) → #1013 (this). Split out of #1006.

✍️ Drafted by Claude Code

@vdusek vdusek added adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. labels Aug 17, 2026
@vdusek vdusek self-assigned this Aug 17, 2026
@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.27%. Comparing base (19509a2) to head (98365c6).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1013      +/-   ##
==========================================
- Coverage   95.29%   95.27%   -0.02%     
==========================================
  Files          59       59              
  Lines        5501     5501              
==========================================
- Hits         5242     5241       -1     
- Misses        259      260       +1     
Flag Coverage Δ
integration 92.23% <ø> (+0.03%) ⬆️
unit 87.36% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek
vdusek force-pushed the docs-custom-http-client-guide branch from 424c3f0 to 7d38520 Compare August 17, 2026 20:30
@vdusek
vdusek changed the base branch from fix-transport-retry-classification to master August 18, 2026 18:23
@vdusek
vdusek force-pushed the docs-custom-http-client-guide branch from 7d38520 to 71bfaa3 Compare August 19, 2026 06:25
@github-actions github-actions Bot added this to the 147th sprint - Tooling team milestone Aug 19, 2026
@vdusek
vdusek force-pushed the docs-custom-http-client-guide branch from 71bfaa3 to e51e3bd Compare August 19, 2026 06:57
@github-actions github-actions Bot added the tested Temporary label used only programatically for some analytics. label Aug 19, 2026
@vdusek vdusek changed the title docs: Rewrite the custom HTTP client guide around the transport-hook contract docs: Document the transport-hook contract and the built-in HTTPX client Aug 19, 2026
@vdusek
vdusek changed the base branch from master to add-httpx-client August 19, 2026 06:57
@vdusek
vdusek marked this pull request as ready for review August 19, 2026 07:07
@vdusek
vdusek requested a review from szaganek as a code owner August 19, 2026 07:07
@vdusek
vdusek marked this pull request as draft August 19, 2026 07:45
@vdusek
vdusek force-pushed the docs-custom-http-client-guide branch from e51e3bd to ccfd59f Compare August 19, 2026 16:37
@vdusek
vdusek force-pushed the docs-custom-http-client-guide branch from ccfd59f to fe6130b Compare August 20, 2026 06:14
Base automatically changed from add-httpx-client to master August 27, 2026 08:58
vdusek added a commit that referenced this pull request Aug 27, 2026
Adds `HttpxHttpClient` / `HttpxHttpClientAsync` as built-in alternatives
to the default Impit transport, behind an optional extra: `pip install
"apify-client[httpx]"`. Impit stays the default.

The transport is [HTTPX2](https://github.com/pydantic/httpx2),
Pydantic's maintained continuation of HTTPX (stable HTTPX has been
parked at 0.28.1 since Dec 2024). The module imports it as `httpx`, so
the client keeps the plain `Httpx*` naming. It verifies TLS via the OS
trust store (`truststore`) rather than `certifi`.

The adapters plug into the shared request pipeline from #1022 and
implement only the transport hooks (`send_request`,
`is_retryable_transport_error`, `is_timeout_error`, `close()` /
`aclose()`), applying the same retry policy as Impit: every error from
the library's own hierarchy is transient except the permanently-failing
types. A response event hook keeps the shared cookie jar from leaking
server cookies into later API requests. Unit tests run the built-in
client matrix (Impit + HTTPX) through the parametrized fixtures.

Note that HTTPX applies timeouts per socket operation, not to the
request as a whole, so a slowly-arriving body can outlast the requested
timeout. Impit enforces a whole-request deadline. Both class docstrings
record this.

Stack: #1022 (merged) → **#1004 (this)** → #1013 (docs — its
`apify-client[httpx]` install lines now match; only the
`conda-forge::httpx` line still points at the stale package instead of
`httpx2`).

*✍️ Drafted by Claude Code*
vdusek added 4 commits August 27, 2026 11:07
…ient-guide

#1004 landed on master, so its files come from there: the HTTPX client, its
tests, the `httpx` extra, and the README install note are taken from master's
merged version, leaving this branch docs-only.
@vdusek
vdusek marked this pull request as ready for review August 27, 2026 11:07
@vdusek
vdusek requested a review from Pijukatel August 27, 2026 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants