Skip to content

Commit 5f8d586

Browse files
Ensure compatibility with httpx v0.28.0+ (#222) (#237)
Co-authored-by: Quentin Pradet <[email protected]> (cherry picked from commit 8b66f40) Co-authored-by: Carl Smedstad <[email protected]>
1 parent 2b510e1 commit 5f8d586

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

elastic_transport/_node/_http_httpx.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,14 @@ async def perform_request( # type: ignore[override]
158158
)
159159
elif isinstance(e, ssl.SSLError):
160160
err = TlsError(str(e), errors=(e,))
161+
# Detect SSL errors for httpx v0.28.0+
162+
# Needed until https://github.com/encode/httpx/issues/3350 is fixed
163+
elif isinstance(e, httpx.ConnectError) and e.__cause__:
164+
context = e.__cause__.__context__
165+
if isinstance(context, ssl.SSLError):
166+
err = TlsError(str(context), errors=(e,))
167+
else:
168+
err = ConnectionError(str(e), errors=(e,))
161169
else:
162170
err = ConnectionError(str(e), errors=(e,))
163171
self._log_request(

setup.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@
6565
"requests",
6666
"aiohttp",
6767
"httpx",
68-
# https://github.com/encode/httpx/discussions/3214#discussioncomment-10830925
69-
"httpcore<1.0.6",
7068
"respx",
7169
"opentelemetry-api",
7270
"opentelemetry-sdk",

0 commit comments

Comments
 (0)