Python 第三方包 requests 遇到 error 54, 'Connection reset by peer'。有可能是需要再安全一些依赖包。
出现
Traceback (most recent call last):
File "/Users/mac/Desktop/upload_to_qiniu/demo4_full_download.py", line 44, in <module>
download_img()
File "/Users/mac/Desktop/upload_to_qiniu/demo4_full_download.py", line 35, in download_img
response = requests.get(name, stream=True)
File "/Users/mac/virtualenvs/pydjango/lib/python2.7/site-packages/requests/api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "/Users/mac/virtualenvs/pydjango/lib/python2.7/site-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/Users/mac/virtualenvs/pydjango/lib/python2.7/site-packages/requests/sessions.py", line 502, in request
resp = self.send(prep, **send_kwargs)
File "/Users/mac/virtualenvs/pydjango/lib/python2.7/site-packages/requests/sessions.py", line 612, in send
r = adapter.send(request, **kwargs)
File "/Users/mac/virtualenvs/pydjango/lib/python2.7/site-packages/requests/adapters.py", line 490, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(54, 'Connection reset by peer'))
根据
Python client error 'Connection reset by peer'
pip install pyopenssl ndg-httpsclient pyasn1