首页 > Web开发 > 详细

unittest requests InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised.

时间:2021-05-15 00:42:21      阅读:27      评论:0      收藏:0      [点我收藏+]
unittest requests 在添加了以下代码依然出现以下错误:
1 import urllib3
2 urllib3.disable_warnings()
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,

解决办法:
def setUp(self): 添加以下 红色代码即可
1 def setUp(self):
2   
3     #  解决错误 ResourceWarning: Enable tracemalloc to get the object allocation traceback
4     warnings.simplefilter(ignore,ResourceWarning) 
5        self.s = requests.session()
6        self.s.verify= False
7        # 解决 InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised.     
8        requests.packages.urllib3.disable_warnings()

 

unittest requests InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised.

原文:https://www.cnblogs.com/levia/p/14770375.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!