The Fix
pip install requests==2.27.0
Based on closed psf/requests issue #3616 · 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%.
@@ -3,6 +3,15 @@
---------------
+dev
++++
+
Option A — Upgrade to fixed release\npip install requests==2.27.0\nWhen NOT to use: This fix is not suitable if backward compatibility with IDNA 2003 is required.\n\n
Why This Fix Works in Production
- Trigger: Using the deprecated IDNA 2003 codec can lead to failures in domain name resolution for certain TLDs.
- Mechanism: The standard library only includes the deprecated IDNA 2003 codec, which is problematic for certain ccTLDs
- Why the fix works: Adds support for IDNA 2008 by vendoring the idna module, addressing issue #3616. (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
- The standard library only includes the deprecated IDNA 2003 codec, which is problematic for certain ccTLDs
- Production symptom (often without a traceback): Using the deprecated IDNA 2003 codec can lead to failures in domain name resolution for certain TLDs.
Proof / Evidence
- GitHub issue: #3616
- Fix PR: https://github.com/psf/requests/pull/3620
- First fixed release: 2.27.0
- Reproduced locally: No (not executed)
- Last verified: 2026-02-07
- Confidence: 0.95
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.87
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“It is fine by me. Happy to support widespread use of the modern IDNA standard however I can.”
“I'm 👍 on it. I think making it non-optional is an excellent idea.”
“+1 for me. I agree with @sigmavirus24 on making it non-optional.”
“Hey, @ralphbean has asked me to take over being the point of contact for Fedora packaging interactions. I'm fine with this and I'm also fine…”
Failure Signature (Search String)
- Using the deprecated IDNA 2003 codec can lead to failures in domain name resolution for certain TLDs.
Copy-friendly signature
Failure Signature
-----------------
Using the deprecated IDNA 2003 codec can lead to failures in domain name resolution for certain TLDs.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Using the deprecated IDNA 2003 codec can lead to failures in domain name resolution for certain TLDs.
What Broke
Using the deprecated IDNA 2003 codec can lead to failures in domain name resolution for certain TLDs.
Why It Broke
The standard library only includes the deprecated IDNA 2003 codec, which is problematic for certain ccTLDs
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/3620
First fixed release: 2.27.0
Last verified: 2026-02-07. Validate in your environment.
When NOT to Use This Fix
- This fix is not suitable if backward compatibility with IDNA 2003 is required.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- Capture the exact failing error string in logs and tests so you can reproduce via a minimal script.
- Pin production dependencies and upgrade only with a reproducible test that hits the failing path.
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.