美文网首页
Python:requests库提示警告

Python:requests库提示警告

作者: _简姑娘_ | 来源:发表于2020-11-05 23:09 被阅读0次

    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

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

    image.png

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

    req = requests.get(url, verify=False)
    

    转载自:https://blog.csdn.net/qq_35304570/article/details/79826990

    相关文章

      网友评论

          本文标题:Python:requests库提示警告

          本文链接:https://www.haomeiwen.com/subject/yvogmktx.html