UNSAFE_LEGACY_RENEGOTIATION_DISABLED问题解决

 

Here’s the table of contents:

  1. UNSAFE_LEGACY_RENEGOTIATION_DISABLED问题解决

UNSAFE_LEGACY_RENEGOTIATION_DISABLED问题解决

  • 可以降低版本到 OpenSSL 1.1.1 或使用以下代码:
import urllib3
from urllib3.util.ssl_ import create_urllib3_context

ctx = create_urllib3_context()
ctx.load_default_certs()
ctx.options |= 0x4  # ssl.OP_LEGACY_SERVER_CONNECT

with urllib3.PoolManager(ssl_context=ctx) as http:
    r = http.request("GET", "https://nomads.ncep.noaa.gov/")
    print(r.status)

GITHUB: ssl.SSLError: [SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled (_ssl.c:1131)