在使用requests庫進行請求操作時,發生下面的提示:
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:794: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
解決方法(親測有效):
在python3代碼中添加以下代碼即可解決:
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
Python2添加如下代碼即可解決:
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)