使用requests 访问https的网页 返回错误: InsecurePlatformWarning: A true SSLContext object is not available

C:\Python27\lib\site-packages\requests\packages\urllib3\util\ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indicatio
n) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. Y
ou can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.or ... ning.
SNIMissingWarning
C:\Python27\lib\site-packages\requests\packages\urllib3\util\ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urll
ib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more infor
 
访问http的网页正常,可是一旦访问到https的就都返回上面的错误
已邀请:

李魔佛 - 左手的厨子

赞同来自:

解决方法:
1. 升级request到最新版本: pip install requests --upgrade
 
如果问题仍然存在,尝试方法2.
 
方法2. 安装request[security]
 
安装命令: pip install requests[security]
 
安装后重新运行python脚本就可以了

要回复问题请先登录注册