feat: Unify the request pipeline across HTTP clients - #1022
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1022 +/- ##
==========================================
+ Coverage 94.90% 94.96% +0.05%
==========================================
Files 58 58
Lines 5418 5438 +20
==========================================
+ Hits 5142 5164 +22
+ Misses 276 274 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Aug 18, 2026
vdusek
marked this pull request as ready for review
August 19, 2026 07:07
Pijukatel
approved these changes
Aug 19, 2026
Pijukatel
left a comment
Contributor
There was a problem hiding this comment.
I see your PR attracted some of my comments to pre-existing code. Well, that is what you get for moving the code around :-D
…acter-count check
…pipeline # Conflicts: # tests/unit/test_client_errors.py
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*
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.
Moves
call, the retry loop, and the per-attempt request handling fromImpitHttpClientandImpitHttpClientAsyncintoHttpClientandHttpClientAsync, leaving Impit as a thin adapter over the transport hooks:send_request,is_retryable_transport_error,is_timeout_error, andclose()/aclose()plus context managers. A custom client that overridescallkeeps working unchanged and opts out of the shared pipeline.StreamedLogclassifies timeouts through the transport-neutralis_timeout_errorhook instead of importing Impit.No behavior change for the built-in clients: the retry policy shipped in #1019 (permanent transport errors fail fast) and #1020 (a failed read of a streamed error body is classified like a failed send and the response is closed) is preserved — the classification now lives in the
is_retryable_transport_errorhook, and the error-body read handling in the shared pipeline.Supersedes #1011, rebased onto current master and squashed. Originally split out of #1006.
Stack: #1022 (this) → #1004 (HTTPX client) → #1013 (docs).
✍️ Drafted by Claude Code