将请求与TLS一起使用不会提供SNI支持

编程入门 行业动态 更新时间:2024-10-28 19:28:45
本文介绍了将请求与TLS一起使用不会提供SNI支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用与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支持

本文发布于:2023-11-13 14:00:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1584511.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:TLS   SNI

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!