Jump to solution
Details

The Fix

Adds support for proxy tunnels for Python 3.6 + asyncio, addressing the compatibility issue raised in issue #515.

Based on closed encode/httpx issue #515 · PR/commit linked

Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.

Open PR/Commit
@@ -58,16 +58,49 @@ async def start_tls( ) -> "SocketStream": loop = asyncio.get_event_loop() - if not hasattr(loop, "start_tls"): # pragma: no cover - raise NotImplementedError( - "asyncio.AbstractEventLoop.start_tls() is only available in Python 3.7+"
fix.md
Option A — Apply the official fix\nAdds support for proxy tunnels for Python 3.6 + asyncio, addressing the compatibility issue raised in issue #515.\nWhen NOT to use: Do not use if it changes public behavior or if the failure cannot be reproduced.\n\n

Why This Fix Works in Production

  • Trigger: HTTPX claims Python 3.6+ support when asyncio backend TCPStream.start_tls explicitly does not support Python 3.6
  • Mechanism: Adds support for proxy tunnels for Python 3.6 + asyncio, addressing the compatibility issue raised in issue #515.
Production impact:
  • If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.

Why This Breaks in Prod

  • Shows up under Python 3.6 in real deployments (not just unit tests).
  • Production symptom (often without a traceback): HTTPX claims Python 3.6+ support when asyncio backend TCPStream.start_tls explicitly does not support Python 3.6

Proof / Evidence

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“Unfortunately Python 3.6 doesn't ship with start_tls() support on the asyncio event loop so you'll only hit this issue when using HTTP proxies. :( If…”
@sethmlarson · 2019-11-08 · source
“I understood why the check and exception existed”
@thebigmunch · 2019-11-08 · source
“Well, it would be a shame to declare only 3.7+ is supported when actually the vast majority of the features (all except proxies, actually) are…”
@florimondmanca · 2019-11-08 · source
“I'm absolutely okay with us supporting 3.6, but not providing full proxies support in that case”
@lovelydinosaur · 2019-11-08 · source

Failure Signature (Search String)

  • HTTPX claims Python 3.6+ support when asyncio backend TCPStream.start_tls explicitly does not support Python 3.6
  • I understood why the check and exception existed. My main point is that if httpx doesn't fully support 3.6, it really should be 3.7+.
Copy-friendly signature
signature.txt
Failure Signature ----------------- HTTPX claims Python 3.6+ support when asyncio backend TCPStream.start_tls explicitly does not support Python 3.6 I understood why the check and exception existed. My main point is that if httpx doesn't fully support 3.6, it really should be 3.7+.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- HTTPX claims Python 3.6+ support when asyncio backend TCPStream.start_tls explicitly does not support Python 3.6 I understood why the check and exception existed. My main point is that if httpx doesn't fully support 3.6, it really should be 3.7+.

Environment

  • Python: 3.6
  • httpx: 0.8

Fix Options (Details)

Option A — Apply the official fix

Adds support for proxy tunnels for Python 3.6 + asyncio, addressing the compatibility issue raised in issue #515.

When NOT to use: Do not use if it changes public behavior or if the failure cannot be reproduced.

Fix reference: https://github.com/encode/httpx/pull/521

Last verified: 2026-02-11. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • Do not use if it changes public behavior or if the failure cannot be reproduced.

Did This Fix Work in Your Case?

Quick signal helps us prioritize which fixes to verify and improve.

Prevention

  • Add a CI check that diffs key outputs after upgrades (OpenAPI schema snapshots, JSON payload shapes, CLI output).
  • Upgrade behind a canary and run integration tests against the canary before 100% rollout.
  • Add a TLS smoke test that performs a real handshake in CI (include CA bundle validation and hostname checks).
  • Alert on handshake failures by error string and endpoint to catch cert/CA changes quickly.

Version Compatibility Table

VersionStatus
3.6 Broken
3.7 Broken

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.