Replace requests with httpx2 and add an asynchronous client - #635
Open
wendigo wants to merge 1 commit into
Open
Conversation
Migrate the HTTP stack from requests to httpx2, with HTTP/2 negotiated via ALPN on TLS connections and transparent HTTP/1.1 fallback. - Extract the transport-agnostic protocol logic (headers, response processing, retry decisions, session state, segment decoding) into trino/_protocol.py, shared by the sync and async clients. - Rework trino.auth: Authentication now contributes get_http_auth() and get_client_arguments() since verify/cert/trust_env are constructor-only in httpx; OAuth2 is an httpx2.Auth generator flow working for both sync and async clients; Kerberos/GSSAPI use an in-repo SPNEGO flow on python-gssapi (trino/_spnego.py) instead of requests_kerberos and requests_gssapi. - Add trino.aio, an asynchronous DBAPI-like interface on httpx2.AsyncClient with spooled protocol support (async segment downloads, heartbeat task, acknowledgment tasks drained on close). - Replace httpretty with a hand-written recording MockTrinoServer over httpx2.MockTransport serving sync and async unit tests alike.
wendigo
force-pushed
the
user/serafin/httpx2
branch
from
August 31, 2026 16:32
5a3d9b2 to
dee8b39
Compare
Contributor
Author
|
Thoughts @hashhar @azawlocki-sbdt ? |
Contributor
|
@wendigo, I see three commits here (requests -> httpx2, refactor to _protocol.py, async API), not just a single one. |
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.
Migrate the HTTP stack from requests to httpx2, with HTTP/2 negotiated via ALPN on TLS connections and transparent HTTP/1.1 fallback.
Description
Non-technical explanation
Release notes
( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text: