問題:/usr/lib/python3/dist-packages/urllib3/connectionpool.py:794: InsecureRequestWarning: Unverified

在使用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)

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章