我正在使用与Django应用通信的请求,但是
I'm using requests to communicate with a django app but
当我尝试
requests.get('mysite', verify=True)我得到了错误:
主机名"mysite"与"* .myhost","myhost"都不匹配
hostname 'mysite' doesn't match either of '*.myhost', 'myhost'
但是,当我查看浏览器或 www.digicert/help/证书时看起来不错,花花公子.
However, when I look at the browser, or www.digicert/help/ the certificate looks fine and dandy.
我的主持人建议这是由于请求缺乏SNI支持(Github似乎证实了 github. com/kennethreitz/requests/issues/749 ).有没有人发现使用请求的解决方法?
My host suggested it was the lack of SNI support from requests (and Github seems to confirm that github/kennethreitz/requests/issues/749 ). Has anyone found a work-around using requests?
推荐答案SNI可以很好地使用Requests的当前版本. 进一步了解GitHub问题,您可以看到以下要求:
The current version of Requests should be just fine with SNI. Further down the GitHub issue you can see the requirements:
- pyOpenSSL
- ndg-httpsclient
- pyasn1
- pyOpenSSL
- ndg-httpsclient
- pyasn1
尝试安装这些软件包,然后再试一下.
Try installing those packages and then give it another shot.
编辑:从v2.12.1版开始,不再需要ndg-httpsclient和pyasn1.现在,所需软件包的完整列表为:
EDIT: As of Requests v2.12.1, ndg-httpsclient and pyasn1 are no longer required. The full list of required packages is now:
- pyOpenSSL
- idna
更多推荐
将请求与TLS一起使用不会提供SNI支持
发布评论