码迷,mamicode.com
首页 > Web开发 > 详细

requests连接https的问题

时间:2017-11-09 21:01:23      阅读:362      评论:0      收藏:0      [点我收藏+]

标签:uri   urllib   pac   for   pytho   证书   错误   tac   问题   

sslv3 alert handshake failure错误,参考https://stackoverflow.com/questions/31730819/python-sslerror-using-requests-for-surveymonkey-com

requests.exceptions.SSLError: HTTPSConnectionPool(host=‘125.71.214.6‘, port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, u‘[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:661)‘),))

头里面添加如下代码即可(linux上问题解决)
import requests.packages.urllib3.util.ssl_ requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS = ‘ALL‘


证书校验错误
[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)


网站不是官方的公钥,如下,添加verify参数为False问题即解决
response = requests.get(url, params=data, headers=security_headers, timeout=2, verify=False)
 

requests连接https的问题

标签:uri   urllib   pac   for   pytho   证书   错误   tac   问题   

原文地址:http://www.cnblogs.com/inns/p/7810967.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!