已解决(Python爬虫requests库报错 请求异常SSL错误,证书认证失败问题)requests.exceptions.SSLError: HTTPSConnectionPool

成功解决(Python爬虫requests库报错 请求异常,SSL错误,证书认证失败问题)requests.exceptions.SSLError: HTTPSConnectionPool(host=‘httpbin.org’, port=443): Max retries exceeded with url: /get (Caused by SSLError(SSLError(1, ‘[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)’)))







报错信息


报错内容

requests.exceptions.SSLError: HTTPSConnectionPool(host=‘httpbin.org’, port=443): Max retries exceeded with url: /get (Caused by SSLError(SSLError(1, ‘[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)’)))


在这里插入图片描述



报错原因


报错内容翻译

请求。例外情况。SSLError:HTTPSConnectionPool(host='httpbin.org',port=443):url:/get超过最大重试次数(由SSLError引起(SSLError(1,“[SSL:WRONG\u VERSION\u NUMBER]WRONG VERSION NUMBER(\u SSL.c:1123)”))

报错原因:请求异常,连接超过最大连接次数,最后是因为证书认证失败。



解决方法


requests.get()请求中添加一个参数verify=False避免ssl认证:


import requests

r = requests.get('https://httpbin.org/get', proxies=proxies, verify=True)

猜你喜欢

转载自blog.csdn.net/yuan2019035055/article/details/125608429