当我们使用requests库访问某些HTTPS网站时,会报出以下警告:
InsecureRequestWarning: Unverified HTTPS request is being made to host 'raw.githubusercontent.com'. Adding certificate verification is strongly advised.
怎么做呢?
requests.packages.urllib3.disable_warnings()
resp = requests.get(url, verify=False)
禁用警告,同时加上verify参数,即可。
网友评论