[Python] 用 requests 出現 InsecureRequestWarning

在換到 requests 之後,因為他使用 urllib3,就會對 https 的網址出現以下警告:

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

解法:

So i got the solution to hide the warning. Here is what i did.

import warnings
from urllib3.exceptions import InsecureRequestWarning
warnings.simplefilter('ignore',InsecureRequestWarning)

warnings.simplefilter('ignore',InsecureRequestWarning)
requests.get('https://github.com/',verify=False)

And this thing solved my problem.

相關文章

寫留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *