0

I can directly download a file that is around 50 megabytes, but when I use python request to do so, it does not work. It returns:

 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("''",))

Here is the url that I've used:

What is the problem?

1 Answers1

0

Try using http:// instead of https:// for your url?

Check out the solution to this question. Might be the solution to the error that you're facing.

Python requests.exception.ConnectionError: connection aborted "BadStatusLine"

Also, it would be helpful to include the url that you're passing into the request in your question.

Community
  • 1
  • 1
Munosphere
  • 174
  • 1
  • 12