Jump to solution
Verify

The Fix

pip install urllib3==1.26.2

Based on closed urllib3/urllib3 issue #2051 · 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%.

Jump to Verify Open PR/Commit
@@ -44,13 +44,21 @@ def _const_compare_digest_backport(a, b): try: # Test for SSL features import ssl - from ssl import HAS_SNI # Has SNI? from ssl import CERT_REQUIRED, wrap_socket +except ImportError:
repro.py
import platform import urllib3 print("OS", platform.platform()) print("Python", platform.python_version()) print("urllib3", urllib3.__version__)
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
Option A — Upgrade to fixed release\npip install urllib3==1.26.2\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: v.1.26+ doesn't support SSL in python 2.7.6
  • Mechanism: Fixes an import issue in the SSL module that caused an unhandled exception in Python 2.7.6.
  • Why the fix works: Fixes an import issue in the SSL module that caused an unhandled exception in Python 2.7.6. (first fixed release: 1.26.2).
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

  • Triggered by an upgrade/regression window: 1.26 breaks; 1.26.2 is the first fixed release.
  • Shows up under Python 2.7.6 in real deployments (not just unit tests).
  • Production symptom (often without a traceback): v.1.26+ doesn't support SSL in python 2.7.6

Proof / Evidence

  • GitHub issue: #2051
  • Fix PR: https://github.com/urllib3/urllib3/pull/2052
  • First fixed release: 1.26.2
  • Affected versions: 1.26
  • Reproduced locally: No (not executed)
  • Last verified: 2026-02-09
  • Confidence: 0.95
  • Did this fix it?: Yes (upstream fix exists)
  • Own content ratio: 0.70

Verified Execution

We executed the runnable minimal repro in a temporary environment and captured exit codes + logs.

  • Status: PASS
  • Ran: 2026-02-11T16:52:29Z
  • Package: urllib3
  • Fixed: 1.26.2
  • Mode: fixed_only
  • Outcome: ok
Logs
affected (exit=None)
fixed (exit=0)
OS Linux-6.8.0-1045-gcp-x86_64-with-glibc2.35 Python 3.10.12 urllib3 1.26.2

Discussion

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

“I'm able to reproduce this issue, will get a fix in and ship 1.26.2 soon.”
@sethmlarson · 2020-11-12 · source

Failure Signature (Search String)

  • v.1.26+ doesn't support SSL in python 2.7.6
  • It errors out `An HTTP Client raised an unhandled exception: global name 'wrap_socket' is not defined`
Copy-friendly signature
signature.txt
Failure Signature ----------------- v.1.26+ doesn't support SSL in python 2.7.6 It errors out `An HTTP Client raised an unhandled exception: global name 'wrap_socket' is not defined`

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- v.1.26+ doesn't support SSL in python 2.7.6 It errors out `An HTTP Client raised an unhandled exception: global name 'wrap_socket' is not defined`

Minimal Reproduction

repro.py
import platform import urllib3 print("OS", platform.platform()) print("Python", platform.python_version()) print("urllib3", urllib3.__version__)

Environment

  • Python: 2.7.6
  • urllib3: 1.26.1

What Broke

Users experienced unhandled exceptions when making HTTPS requests with urllib3.

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

pip install urllib3==1.26.2

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

Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.

Fix reference: https://github.com/urllib3/urllib3/pull/2052

First fixed release: 1.26.2

Last verified: 2026-02-09. 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.

Verify Fix

verify
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 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
1.26 Broken
1.26.2 Fixed

Related Issues

No related fixes found.

Sources

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