问题截图
问题原因
urllib3的1.26.4版本有个bug
https://github.com/urllib3/urllib3/issues/517
解决办法
-
urllib3降低版本:urllib3==1.25.7
-
request方法加上
verify=False
参数
response = requests.request('GET', 'https://httpbin.org/get', 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 InsecureRequestWarning,
- 在request请求前面要加上下面的代码,可以解决上面的警告
requests.packages.urllib3.disable_warnings()