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%.
@@ -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+"
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.
- 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
- GitHub issue: #515
- Fix PR: https://github.com/encode/httpx/pull/521
- Reproduced locally: No (not executed)
- Last verified: 2026-02-11
- Confidence: 0.70
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.67
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…”
“I understood why the check and exception existed”
“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…”
“I'm absolutely okay with us supporting 3.6, but not providing full proxies support in that case”
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
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 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.
Fix reference: https://github.com/encode/httpx/pull/521
Last verified: 2026-02-11. Validate in your environment.
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
| Version | Status |
|---|---|
| 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.