解决方法
在使用request请求前,设置一下:
import requests.packages.urllib3.util.ssl_
requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS = 'ALL'
其他解决方法
博主发现网上有很多其他方法,经过尝试,上面的【解决方法】虽然解决了博主的问题,但是可能没法解决小伙伴们的问题,所以列出几个当时查到的解决方法:
方法1
来源:https://blog.csdn.net/weixin_46084750/article/details/125491776
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
方法2
来源:https://stackoverflow.com/questions/35405092/sslerror-sslv3-alert-handshake-failure
easy_install pyOpenSSL
easy_install ndg-httpsclient
easy_install pyasn1
easy_install
可用pip install
替换
方法3
来源:https://blog.csdn.net/qq_37435462/article/details/121564961
使用request请求URL时,使用下面的方法:
import ssl
import socket
hostname="www.baidu.com" # 这里替换为目标URL
ssl.SSLContext().wrap_socket(socket.socket(socket.AF_INET,socket.SOCK_STREAM), server_hostname=hostname)
方法4(慎用)
来源:https://groups.google.com/g/google-apps-manager/c/CEG7YvNfPmg
export GAM_TLS_MIN_VERSION=TLSv1.2