Skip to content

Feature: add httpx2 support with httpx fallback - #328

Open
CoderJoshDK wants to merge 2 commits into
yanyongyu:masterfrom
CoderJoshDK:httpx2
Open

CoderJoshDK wants to merge 2 commits into
yanyongyu:masterfrom
CoderJoshDK:httpx2

Conversation

@CoderJoshDK

Copy link
Copy Markdown

Deprecate the use of httpx in favor of httpx2 when supplied.

Closes #321
Replaces #324

If the environment of the caller has httpx2 installed, we use that. Otherwise, we give them a deprecation warning.

In the future, httpx should be dropped and a hard cut to the httpx2 namespace should be used. This is to help avoid client mismatch.

@yanyongyu yanyongyu added the enhancement New feature or request label Oct 1, 2026
Comment thread tests/test_httpx.py

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Aware that this file is a bit funky. Honestly, this test can be removed IMO. But up to you.

Comment thread pyproject.toml
"anyio >=3.6.1, <5.0.0",
"httpx >=0.23.0, <1.0.0",
"hishel[async,httpx] >=1.3.0, <=2.0.0",
"hishel[async,httpx] >=1.4.0, <=2.0.0",

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Bump here because this is the first version that supports httpx2. I want to avoid a really strange case where you somehow have httpx2 but not the version of hishel that supports it and you get a super strange import error / explosion. This also makes the _httpx.py file a bit more reliable in its try-except.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support httpx2

2 participants