Replace httpx with requestx HTTP client library #2
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.
Changes being requested
This PR replaces the
httpxHTTP client library withrequestx, a Rust-based implementation that provides a simplified API compatible with httpx.Key Changes:
Dependency Update: Changed from
httpx>=0.23.0, <1torequestx @ git+https://github.com/neuesql/requestx.git@v1.0.5inpyproject.tomlImport Changes: Updated all imports throughout the codebase from
import httpxtoimport requestx as httpxfor compatibilityAPI Compatibility Layer: Created
src/openai/_compat.pywith compatibility shims:QueryParamsclass to replace httpx's QueryParams (requestx doesn't have this)url_copy_with_raw_path()function to handle URL manipulation differencesClient Wrapper Changes:
_DefaultHttpxClientand_DefaultAsyncHttpxClientfrom subclasses to factory functions since requestx clients (implemented in Rust) don't support subclassingSyncHttpxClientWrapperandAsyncHttpxClientWrapperto use composition instead of inheritanceURL/Query Parameter Handling:
url.copy_with(params=...)tourl.copy_with(query=...)where neededraw_pathoperationsProxy Configuration:
httpx.Proxy(http=..., https=...)instead ofHTTPTransportRemoved Dependencies:
httpx_aiohttpfrom optional dependencies as it's not compatible with requestxrespxto use a custom fork for requestx compatibilityDocumentation Updates: Updated README examples to show requestx usage and added notes about API differences
Compatibility Notes:
HTTPTransportare not supportedaiohttpclient option is no longer availableAdditional context & links
This change enables the use of requestx, a high-performance Rust-based HTTP client that maintains API compatibility with httpx while providing better performance characteristics.
https://claude.ai/code/session_01LNGCMPexQ9NESHdPMdSCXj