requests库提示警告:InsecureRequestWarning_ Unverified H

requests库提示警告: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)

1、Python3访问HTTPS时移除SSL认证:

req = requests.get(url, verify=False) 2、但移除认证后控制台总是抛出警告:

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)

3、根据提示路径https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings可找到方法一些解决办法,简单的办法可用移除警告:disable_warnings()

在请求代码前添加如下代码即可:

requests.packages.urllib3.disable_warnings() ———————————————— 版权声明:本文为CSDN博主「潜行100」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/qq_35304570/article/details/79826990

关闭访问时的证书警告,也可能关闭了其他警告

使用 Hugo 构建
主题 StackJimmy 设计