requests模块的SSL Error

第一次是爬取贴吧时,在使用requests时报错SSLError,

通过禁用校验参数可以解决

requests.get(url, verify=False)

第二次是使用itchat登录微信时,又报错了SSLError

SSLError: HTTPSConnectionPool(host='https://login.weixin.qq.com', port=443): 
 (Caused by SSLError(SSLError(8, '_ssl.c:507: EOF occurred in violation of protocol'),))

因为已经封装好了,所以通过第一种方法不太方便,于是有了下面的方法

pip3 uninstall -y certifi
pip3 install certifi

通过重新安装certifi这个包就能解决,一劳永逸

出现这个原因应该是云服务器上的证书过时了,重新安装最新版即可解决

猜你喜欢

转载自www.cnblogs.com/presleyren/p/12216928.html