使用requess库访问https网址时,返回
(Caused by SSLError(SSLError(1, '[SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled (_ssl.c:1147)')))
原因可能是服务器的认证方式版本太低然后requests抛弃了这种认证方式
参考:python - SSL error unsafe legacy renegotiation disabled - Stack Overflow
解决方法
python
import ssl
import urllib.request
url = ""
# Set up SSL context to allow legacy TLS versions
ctx = ssl.create_default_context(ssl.Purpose.SERVER_AUTH)
ctx.options |= 0x4 # OP_LEGACY_SERVER_CONNECT
# Use urllib to open the URL and read the content
response = urllib.request.urlopen(url, context=ctx)
print(response.read().decode())
补充,或者这种(把代理部分的参数去掉)