解决Python3 控制台输出InsecureRequestWarning问题
作者:原来你也在这里na 时间:2021-08-04 21:17:57
解决Python3 控制台输出InsecureRequestWarning的问题
问题:
使用Python3 requests发送HTTPS请求,已经关闭认证(verify=False)情况下,控制台会输出以下错误:
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
解决方法:
在代码中添加以下代码即可解决:
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
Python2添加如下代码即可解决:
from requests.packages.urllib3.exceptions import InsecureRequestWarning
# 禁用安全请求警告
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
ps:下面在给大家介绍python3 requests禁用安全请求警告
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
# 禁用安全请求警告
控制台输出移除SSL认证警告
总结
以上所述是小编给大家介绍的解决Python3 控制台输出InsecureRequestWarning问题 ,网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!
来源:https://www.cnblogs.com/ernana/p/8601789.html
标签:python,requests,控制台,警告
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Go事务中止时是否真的结束事务解析
2023-07-07 11:35:35
python中使用.py配置文件的方法详解
2022-02-13 19:57:22
创意设计:字母趣味组合
2008-01-26 18:50:00
![](https://img.aspxhome.com/file/UploadPic/20081/26/20081261932359s.jpg)
在ASP中使用Oracle数据库技巧
2008-05-17 11:47:00
Python浅析迭代器Iterator的使用
2023-11-07 12:04:25
Python批量按比例缩小图片脚本分享
2022-06-06 11:46:12
JS获取页面窗口实际大小函数
2008-01-28 13:18:00
django celery redis使用具体实践
2022-12-03 02:45:39
![](https://img.aspxhome.com/file/2023/5/87785_0s.png)
PHP实现HTML页面静态化的方法
2023-10-15 04:09:59
![](https://img.aspxhome.com/file/2023/3/72683_0s.png)
用Dreamweaver制作活动菜单条
2009-07-10 13:15:00
![](https://img.aspxhome.com/file/UploadPic/20072/200723113334999s.jpg)
二级联动下拉菜单javascript源码
2010-03-16 12:32:00
盘点十个超级好用的高级Python脚本
2023-12-04 23:41:27
![](https://img.aspxhome.com/file/2023/0/69630_0s.png)
Chrome调试折腾记之JS断点调试技巧
2023-07-07 16:35:08
![](https://img.aspxhome.com/file/2023/1/55901_0s.png)
那些被我遗忘掉的XHTML标签们
2008-06-07 14:27:00
python使用rstrip函数删除字符串末位字符
2023-06-10 16:59:56
ASP程序中输出Excel文件实例一则
2008-11-07 15:29:00
Python3接口性能测试实例代码
2021-02-16 14:24:18
FrontPage XP设计教程3——网页的布局
2008-10-11 12:20:00
![](https://img.aspxhome.com/file/UploadPic/200810/17/20081017122538589s.jpg)
Python中的高级数据结构详解
2022-02-20 04:01:09
![](https://img.aspxhome.com/file/2023/4/72844_0s.jpg)
python函数参数*args**kwargs用法实例
2021-03-25 14:19:41
![](https://img.aspxhome.com/file/2023/3/80463_0s.png)