requests.exceptions.SSLError: [Errno 1] _ssl.c:504: error:14090086:SSL routines: SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
今天使用requests 请求https 站点下载东西时报错SSL,发现可通过在requests.get()中增加参数verify=False来解决。
>>> url = "https://heartconnect.bostonscientific.com/client/latest/HeartConnectInstaller.EXE"
>>> r = requests.get(url)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\python27\lib\site-packages\requests-2.2.1-py2.7.egg\requests\api.py", line 55, in get
return request('get', url, **kwargs)
File "C:\python27\lib\site-packages\requests-2.2.1-py2.7.egg\requests\api.py", line 44, in request
return session.request(method=method, url=url, **kwargs)
File "C:\python27\lib\site-packages\requests-2.2.1-py2.7.egg\requests\sessions.py", line 383, in request
resp = self.send(prep, **send_kwargs)
File "C:\python27\lib\site-packages\requests-2.2.1-py2.7.egg\requests\sessions.py", line 486, in send
r = adapter.send(request, **kwargs)
File "C:\python27\lib\site-packages\requests-2.2.1-py2.7.egg\requests\adapters.py", line 385, in send
raise SSLError(e)
requests.exceptions.SSLError: [Errno 1] _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate
verify failed
>>>
>>> r = requests.get(url,verify=False)
>>> r
<Response [200]>
>>>