使用python requests 框架包访问https://itunes.apple.com 页面是遇到 SSLError: hostname 'itunes.apple.com' doesn't match either of 错误,

但本地开发时没报错,而是在线上报错,python版本是2.7.3,后来gg到是因为版本问题,安装好pyOpenSSLndg-httpsclientpyasn1 即可,发现确实可行。

These errors occur when SSL certificate verification fails to match the certificate the server responds with to the hostname Requests thinks it's contacting. If you're certain the server's SSL setup is correct (for example, because you can visit the site with your browser) and you're using Python 2.6 or 2.7, a possible explanation is that you need Server-Name-Indication.

Server-Name-Indication, or SNI, is an official extension to SSL where the client tells the server what hostname it is contacting. This is important when servers are using Virtual Hosting. When such servers are hosting more than one SSL site they need to be able to return the appropriate certificate based on the hostname the client is connecting to.

Python3 and Python 2.7.9+ include native support for SNI in their SSL modules. For information on using SNI with Requests on Python < 2.7.9 refer to this Stack Overflow answer.

The current version of Requests should be just fine with SNI. Further down the GitHub issue you can see the requirements:

Try installing those packages and then give it another shot.

参考资料:

1、http://docs.python-requests.org/en/master/community/faq/#what-are-hostname-doesn-t-match-errors

2、  https://stackoverflow.com/questions/18578439/using-requests-with-tls-doesnt-give-sni-support/18579484#18579484

最新文章

  1. ElasticSearch 5学习(6)——分布式集群学习分享1
  2. Lr中关于字符串的截取
  3. windows7 64位下环境搭建scrapy爬虫框架
  4. Android事件处理机制
  5. 各种边缘检测算子特点比较(canny)
  6. delphi 怎么获取工程版本号
  7. 深入了解javascript事件流
  8. 浅谈React受控与非受控组件
  9. UIScrollView常见属性
  10. Speed-BI云平台正在公测中,欢迎大家体验!
  11. 样式其他与JS脚本语言
  12. 亲测 logminer挖掘
  13. linux —— shell 编程(整体框架与基础笔记)
  14. Asp,题目
  15. Win10 UWP Intro to controls and events
  16. 【转】awk 数组用法【精华贴】
  17. php做的一个简易爬虫
  18. Redis的安装及学习
  19. HDFS集群PB级数据迁移方案-DistCp生产环境实操篇
  20. 课程一(Neural Networks and Deep Learning),第二周(Basics of Neural Network programming)—— 1、10个测验题(Neural Network Basics)

热门文章

  1. html小技巧
  2. 个人CTF资源聚合
  3. [LeetCode] Find All Numbers Disappeared in an Array 找出数组中所有消失的数字
  4. [LeetCode] Design Tic-Tac-Toe 设计井字棋游戏
  5. [LeetCode] H-Index II 求H指数之二
  6. jQuery Ajax 实例 ($.ajax、$.post、$.get)
  7. 1205索引使用explain
  8. [HTML5] Blob对象
  9. BZOJ3670 [Noi2014]动物园
  10. CentOS 7 安装 配置 MySQL