主页 > 编程资料 > Python >
发布时间:2018-09-06 作者:apizl 阅读:419次

Python在使用requests访问HTTPS网站时,如果关闭了证书验证,就得输出一句警告日志:

C:\Python27\lib\site-packages\urllib3\connectionpool.py:858: 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)

禁用警告日志输出很简单,加入这一句代码就可以了:


import requests

requests.packages.urllib3.disable_warnings()


一般情况下:

Python Requests InsecureRequestWarning: Unverified HTTPS...


关闭输出警告日志:

Python Requests InsecureRequestWarning: Unverified HTTPS...


关键字词: