問題:
使用Python3 requests發送HTTPS請求,已經關閉認證(verify=False)情況下,控制台會輸出以下錯誤:
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
解決方法:
在代碼中添加以下代碼即可解決:
import urllib3 urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
Python2添加如下代碼即可解決:
from requests.packages.urllib3.exceptions import InsecureRequestWarning # 禁用安全請求警告 requests.packages.urllib3.disable_warnings(InsecureRequestWarning)