码迷,mamicode.com
首页 > 编程语言 > 详细

python requests

时间:2015-03-31 12:17:34      阅读:220      评论:0      收藏:0      [点我收藏+]

标签:

[About]

http://www.python-requests.org/en/latest/

[与urllib2比较]

http://www.oschina.net/code/snippet_782578_27510

[错误]

requests.exceptions.SSLError:[Errno 1] _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate veryfy failed

重现

import requests

url=https://self-sign web/‘ #自签名HTTPS站点
requests.get(url)

解决办法1:

import requests

url=https://self-sign web/
requests.get(url, verify=False) #不验证

解决办法2:

import requests

url=‘https://self-sign web/‘
requests.get(url, verify=‘/etc/pki/tls/certs/server.crt‘) #指定证书

[错误2]

requests.exceptions.SSLError: hostname ‘XXXXX‘ doesn‘t match u‘YYYYY‘

证书中主机描述与实际不符

python requests

标签:

原文地址:http://www.cnblogs.com/flowjacky/p/4380134.html

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