美文网首页
Python的requests库访问HTTPS网站时提示警告解决

Python的requests库访问HTTPS网站时提示警告解决

作者: testerzhang | 来源:发表于2020-12-10 14:18 被阅读0次

当我们使用requests库访问某些HTTPS网站时,会报出以下警告:

InsecureRequestWarning: Unverified HTTPS request is being made to host 'raw.githubusercontent.com'. Adding certificate verification is strongly advised.

怎么做呢?

                requests.packages.urllib3.disable_warnings()
                resp = requests.get(url, verify=False)

禁用警告,同时加上verify参数,即可。

相关文章

网友评论

      本文标题:Python的requests库访问HTTPS网站时提示警告解决

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