python httpss_python requests.get https 日志

爬取目标是https站点,目前环境是python2.7。requests.get("https://blog.pucipuci.cn/checkip.php",verify=False)

报警告/var/python2.7/lib/python2.7/site-packages/urllib3/util/ssl_.py:339: SNIMissingWarning: An HTTPS request has been made, but

the SNI (Subject Name Indication) 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. You can upgrade to a newer version of Python to solve this.

For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings

SNIMissingWarning

/var/python2.7/lib/python2.7/site-packages/urllib3/util/ssl_.py:137: InsecurePlatformWarning: A true SSLContext object is not

available. This prevents urllib3 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 information, see

https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings

InsecurePlatformWarning

虽然报警告,但内容还是有的。

处理pip install pyopenssl ndg-httpsclient pyasn1

安装失败

报错中有一个 No package 'libffi' found

处理yum install libffi-devel

虽然安装失败,但无法再重新安装 必须卸载原安装的包pip uninstall pyopenssl ndg-httpsclient pyasn1

pip install pyopenssl ndg-httpsclient pyasn1

报错:Could not find .egg-info directory in install record for cryptography>=1.9 (from pyopenssl)

处理pip install --upgrade setuptools pip

pip uninstall pyopenssl ndg-httpsclient pyasn1

pip install pyopenssl ndg-httpsclient pyasn1

再运行requests.get("https://blog.pucipuci.cn/checkip.php",verify=False)

还有一行警告,/var/python2.7/lib/python2.7/site-packages/urllib3/connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is

being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-

usage.html#ssl-warnings

InsecureRequestWarning)

去掉 verify=Falserequests.get("https://blog.pucipuci.cn/checkip.php",verify=False)

成功html = requests.get("https://blog.pucipuci.cn/checkip.php")

print(html.content)

输出正确内容,无警告。

非特殊说明,本博所有文章均为博主原创。

最新文章

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值