我可以直接下载大约50兆字节的文件,但是当我使用python请求时,它不起作用。它返回:
r = sss.get(url, stream=True, headers=my_headers)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests-2.8.1-py2.7.egg/requests/sessions.py", line 480, in get
return self.request('GET', url, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests-2.8.1-py2.7.egg/requests/sessions.py", line 468, in request
resp = self.send(prep, **send_kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests-2.8.1-py2.7.egg/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests-2.8.1-py2.7.egg/requests/adapters.py", line 426, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine("''",))
以下是我使用过的网址:
有什么问题?
答案 0 :(得分:0)
尝试使用 http:// 代替 https:// 作为您的网址?
查看此问题的解决方案。可能是你所面临的错误的解决方案。
Python requests.exception.ConnectionError: connection aborted "BadStatusLine"
此外,在您的问题中包含您传入请求的网址会很有帮助。