前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >如何解决InsecureRequestWarning

如何解决InsecureRequestWarning

作者头像
用户8418197
发布2022-01-22 21:55:52
2.1K0
发布2022-01-22 21:55:52
举报
文章被收录于专栏:howtouselinux

InsecureRequestWarning报错信息

/usr/local/lib/python2.7/site-packages/requests-2.4.0-py2.7.egg/requests/packages/urllib3/connectionpool.py:730: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html (This warning will only appear once by default.)

InsecureRequestWarning)

不要使用verify=False

或者requests.packages.urllib3.disable_warnings()

不要忽视警告

正确的做法

参考

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

https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl

insecurerequestwarning in python urllib3 requests

安装证书进行Certificate verification

It is highly recommended to always use SSL certificate verification.By default, urllib3 does not verify HTTPS requests.

In order to enable verification you will need a set of root certificates. The easiestand most reliable method is to use thecertifi package which provides Mozilla’s root certificate bundle:

pip install certifi

安装几个包

pip install cryptography

pip install pyOpenSSL

pip install certifi

什么是Certifi

Trust Database for Humans

Certifi is a carefully curated collection of Root Certificates forvalidating the trustworthiness of SSL certificates while verifying theidentity of TLS hosts. It has been extracted from theRequests project.

The internet is an untrusted place. Every HTTP request you make should haveverification on by default. This happens every time you access a website withyour web browser, without any knowledge to the user — there’s no reason yourcode should be any different.

Certifi is here to make this possible.

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文系转载前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
作者已关闭评论
0 条评论
热度
最新
推荐阅读
目录
  • InsecureRequestWarning报错信息
  • 安装证书进行Certificate verification
  • 什么是Certifi
相关产品与服务
SSL 证书
腾讯云 SSL 证书(SSL Certificates)为您提供 SSL 证书的申请、管理、部署等服务,为您提供一站式 HTTPS 解决方案。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档