Python常见问题 - python3 requests库提示警告InsecureRequestWarning的问题

2020-06-09 15:17:11 浏览数 (1)

当使用 requests 库发送请求时报了以下警告

代码语言:javascript复制
D:python3.6libsite-packagesurllib3connectionpool.py:847: 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)

如何解决

代码语言:javascript复制
import requests

# 加上这行代码即可,关闭安全请求警告
requests.packages.urllib3.disable_warnings()

0 人点赞