OpenSSL.SSL.Error: [('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')](ssl证书问题)
该问题的原因是:因为网址使用了https,所以经过代理时会报错。报错原因是:Python3之关闭SSL证书验证
解决办法是:关闭验证SSL证书开关,verify:Ture/False,默认是Ture,用于验证SSL证书开关。例如:requests.get(url=url,headers=headers,verify=False)
但是这样发送请求后,虽然有数据,但是还是会报错(
C:\Program Files\Python37\lib\site-packages\urllib3\connectionpool.py:847: 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)
),这个时候还要加一条requests.packages.urllib3.disable_warnings(),即禁用安全请求警告。
这样就没问题了,附下面的代码:
import requests requests.packages.urllib3.disable_warnings() url = headers = { } response = requests.get(url=url,headers=headers,verify=False) print(response.text)