The Fix
pip install requests==2.27.0
Based on closed psf/requests issue #6027 · 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%.
@@ -974,6 +974,10 @@ def prepend_scheme_if_needed(url, new_scheme):
netloc, path = path, netloc
+ if auth:
+ # parse_url doesn't provide the netloc with auth
+ # so we'll add it ourselves.
import requests
r = requests.get('https://example.org/', proxies=proxies) # You will need a proxy to test with, I am using a paid service.
print(r.status_code)
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\npip install requests==2.27.0\nWhen NOT to use: This fix should not be used if the application requires the new URL parsing behavior.\n\n
Why This Fix Works in Production
- Trigger: When using proxies in python 3.8.12, I get an error 407. Using any other version of python works fine. I am assuming it could be to do with this
- Mechanism: Fixes a bug where proxy authentication was dropped due to changes in URL parsing.
- Why the fix works: Fixes a bug where proxy authentication was dropped due to changes in URL parsing. (first fixed release: 2.27.0).
- 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
- Dependency interaction matters here: urllib3 v1.25.11.
- Shows up under Python 3.8.12 in real deployments (not just unit tests).
- Production symptom (often without a traceback): When using proxies in python 3.8.12, I get an error 407. Using any other version of python works fine. I am assuming it could be to do with this https://docs.python.org/3/whatsnew/3.8.html#notable-changes-in-python-3-8-12.
Proof / Evidence
- GitHub issue: #6027
- Fix PR: https://github.com/psf/requests/pull/6028
- First fixed release: 2.27.0
- Reproduced locally: No (not executed)
- Last verified: 2026-02-07
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.69
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“So after doing some digging, in my case the params passed to urlunparse in prepend_scheme_if_needed went from: scheme: http netloc: user:pwd@host:port To: scheme: http netloc:…”
“Thanks for confirming @racam and @adamp01”
“Thanks again everyone, we have the fix merged into main. I'm going to wait until tomorrow to release 2.27.1 to see if any other issues…”
“Same issue here. Since 2.27.0 with Python 3.8 I confirm @adamp01 investigation with mine. user:pwd seem to be lost during proxy parsing. I always get…”
Failure Signature (Search String)
- When using proxies in python 3.8.12, I get an error 407. Using any other version of python works fine. I am assuming it could be to do with this
- "pyOpenSSL": {
Copy-friendly signature
Failure Signature
-----------------
When using proxies in python 3.8.12, I get an error 407. Using any other version of python works fine. I am assuming it could be to do with this https://docs.python.org/3/whatsnew/3.8.html#notable-changes-in-python-3-8-12.
"pyOpenSSL": {
Error Message
Signature-only (no traceback captured)
Error Message
-------------
When using proxies in python 3.8.12, I get an error 407. Using any other version of python works fine. I am assuming it could be to do with this https://docs.python.org/3/whatsnew/3.8.html#notable-changes-in-python-3-8-12.
"pyOpenSSL": {
Minimal Reproduction
import requests
r = requests.get('https://example.org/', proxies=proxies) # You will need a proxy to test with, I am using a paid service.
print(r.status_code)
Environment
- Python: 3.8.12
- urllib3: 1.25.11
What Broke
Users receive a 407 Proxy Authentication Required error when using proxies.
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install requests==2.27.0
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/psf/requests/pull/6028
First fixed release: 2.27.0
Last verified: 2026-02-07. Validate in your environment.
When NOT to Use This Fix
- This fix should not be used if the application requires the new URL parsing behavior.
Verify Fix
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- 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 |
|---|---|
| 2.27.0 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.