Skip to content

feat: Unify the request pipeline across HTTP clients - #1022

Merged
vdusek merged 5 commits into
masterfrom
unify-http-request-pipeline
Aug 19, 2026
Merged

feat: Unify the request pipeline across HTTP clients#1022
vdusek merged 5 commits into
masterfrom
unify-http-request-pipeline

Conversation

@vdusek

@vdusekvdusek commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Moves call, the retry loop, and the per-attempt request handling from ImpitHttpClient and ImpitHttpClientAsync into HttpClient and HttpClientAsync, leaving Impit as a thin adapter over the transport hooks: send_request, is_retryable_transport_error, is_timeout_error, and close() / aclose() plus context managers. A custom client that overrides call keeps working unchanged and opts out of the shared pipeline. StreamedLog classifies timeouts through the transport-neutral is_timeout_error hook 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_error hook, 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

@vdusekvdusek self-assigned this Aug 18, 2026
@github-actionsgithub-actionsBot added t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics. labels Aug 18, 2026
@vdusekvdusek added the adhoc Ad-hoc unplanned task added during the sprint. label Aug 18, 2026
@codecov

codecovBot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.88360% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.96%. Comparing base (139a426) to head (8399dd8).
⚠️ Report is 2 commits behind head on master.

Files with missing linesPatch %Lines
src/apify_client/_streamed_log.py75.00%2 Missing ⚠️
src/apify_client/http_clients/_base.py98.64%2 Missing ⚠️
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 
FlagCoverage Δ
integration91.76% <71.95%> (+0.12%)⬆️
unit85.82% <97.88%> (+0.08%)⬆️

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 requested a review from PijukatelAugust 19, 2026 07:39

@PijukatelPijukatel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment threadsrc/apify_client/http_clients/_base.py Outdated
Comment threadsrc/apify_client/http_clients/_base.py Outdated
Comment threadtests/unit/test_pluggable_http_client.py Outdated
@vdusek
vdusek merged commit 00ce055 into masterAug 19, 2026
30 checks passed
@vdusek
vdusek deleted the unify-http-request-pipeline branch August 19, 2026 12:43
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhocAd-hoc unplanned task added during the sprint.t-toolingIssues with this label are in the ownership of the tooling team.testedTemporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@vdusek@Pijukatel@apify-service-account