feat(python): add aiohttp auto-detection for async HTTP client#13585
Closed
fern-support wants to merge 1 commit intomainfrom
Closed
feat(python): add aiohttp auto-detection for async HTTP client#13585fern-support wants to merge 1 commit intomainfrom
fern-support wants to merge 1 commit intomainfrom
Conversation
When httpx_aiohttp is installed, the async client automatically uses it instead of plain httpx.AsyncClient. Adds DefaultAioHttpClient and DefaultAsyncHttpxClient convenience classes with SDK defaults.
|
Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit in Settings → Usage. Once credits are available, reopen this pull request to trigger a review. |
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
httpx_aiohttpat runtime and use it for the async HTTP client when available, falling back to plainhttpx.AsyncClientDefaultAioHttpClientandDefaultAsyncHttpxClientconvenience classes with SDK-appropriate defaults_default_clients.pymodule with optional[aiohttp]extra in pyproject.toml@pytest.mark.aiohttpmarker for two-pass testing (without and with aiohttp installed)Based on: cohere-ai/cohere-python#739
Test plan
pytest -m "not aiohttp"— 6 tests pass (fallback behavior without httpx_aiohttp)pip install httpx-aiohttp && pytest -m "aiohttp"— 3 tests pass (autodetect with httpx_aiohttp)