Repository navigation
Support passing a custom transport to the httpx client (#615) - #659
Merged
Merged
Conversation
The sync and async HTTP clients hardcoded transport=httpx.HTTPTransport() after **self._client_kwargs, so passing transport=... raised TypeError: got multiple values for keyword argument 'transport'. This blocked using caching transports like Hishel. Now the default transport is injected via setdefault (mirroring the existing timeout default), so a caller-supplied transport is honoured and the correct default applies when none is given. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUJyTApfnoWm4Gq8yBgds7
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUJyTApfnoWm4Gq8yBgds7
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #659 +/- ##
=======================================
Coverage 94.04% 94.04%
=======================================
Files 76 76
Lines 3373 3375 +2
=======================================
+ Hits 3172 3174 +2
Misses 201 201 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Summary
Closes #615.
Callers can now pass a custom httpx
transporttoWikipedia/AsyncWikipedia, enabling caching transports such as Hishel.Previously both clients hardcoded
transport=httpx.HTTPTransport()after**self._client_kwargs, so passingtransport=...raisedTypeError: got multiple values for keyword argument 'transport'. The default transport is now injected viasetdefault(mirroring the existingtimeoutdefault), so a caller-supplied transport is honoured and the correct default (httpx.HTTPTransport/httpx.AsyncHTTPTransport) applies when none is given.Changes
sync_http_client.py/async_http_client.py: inject default transport only when the caller didn't supply one.base_http_client.py,wikipedia.py,async_wikipedia.py) mention thetransportkwarg.README.rst(andindex.rst, a symlink): new "Custom HTTP Transport" section;DESIGN.rstnotes.CHANGES.rst:Unreleasedentry.Verification
make run-ruff,make run-type-check,make run-pre-commit: all pass.httpx.MockTransport: sync and async page summaries served through the custom transport with no network.🤖 Generated with Claude Code