Description
I have a problem with downloading a file, when the server returns the 301 code:
r = requests.get('http://servag.rupsy.ru/track.php?url=2013-04-11/Haatzumaniak_-_Dark_Sadhu_[2013]/03.%20Haatzumaniak_-_777_Dark%20Sadhu%202013.mp3&arj=Haatzumaniak_-_Dark_Sadhu_[2013].ZIP')
print(r)
If you do redirect manually - it works fine:
r = requests.get('http://servag.rupsy.ru/track.php?url=2013-04-11/Haatzumaniak_-_Dark_Sadhu_[2013]/03.%20Haatzumaniak_-_777_Dark%20Sadhu%202013.mp3&arj=Haatzumaniak_-_Dark_Sadhu_[2013].ZIP', allow_redirects=False)
r = requests.get(r.headers['Location'])
print(r)
The problem appears to Python 3.3 and python-requests-1.2.0/python-requests-dev
Traceback (most recent call last):
File "C:\Dropbox\projects\Helpers\ph\.envwin32\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 428, in urlopen
body=body, headers=headers)
File "C:\Dropbox\projects\Helpers\ph\.envwin32\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 290, in _make_request
httplib_response = conn.getresponse()
File "c:\Python33\lib\http\client.py", line 1143, in getresponse
response.begin()
File "c:\Python33\lib\http\client.py", line 354, in begin
version, status, reason = self._read_status()
File "c:\Python33\lib\http\client.py", line 324, in _read_status
raise BadStatusLine(line)
http.client.BadStatusLine: ''
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Dropbox\projects\Helpers\ph\.envwin32\lib\site-packages\requests\adapters.py", line 283, in send
timeout=timeout
File "C:\Dropbox\projects\Helpers\ph\.envwin32\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 474, in urlopen
raise MaxRetryError(self, url, e)
requests.packages.urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='servag.rupsy.ru', port=80): Max retries exceeded with url: /media/2/Haatzumaniak_-_Dark_Sadhu_[2013]/03. Haatzumaniak_-_777_Dark Sadhu 2013.mp3 (Caused by <class 'http.client.BadStatusLine'>: '')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Dropbox/projects/InfoStreams/test.py", line 25, in <module>
allow_redirects=True)
File "C:\Dropbox\projects\Helpers\ph\.envwin32\lib\site-packages\requests\api.py", line 55, in get
return request('get', url, **kwargs)
File "C:\Dropbox\projects\Helpers\ph\.envwin32\lib\site-packages\requests\api.py", line 44, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Dropbox\projects\Helpers\ph\.envwin32\lib\site-packages\requests\sessions.py", line 345, in request
resp = self.send(prep, **send_kwargs)
File "C:\Dropbox\projects\Helpers\ph\.envwin32\lib\site-packages\requests\sessions.py", line 464, in send
history = [resp for resp in gen] if allow_redirects else []
File "C:\Dropbox\projects\Helpers\ph\.envwin32\lib\site-packages\requests\sessions.py", line 464, in <listcomp>
history = [resp for resp in gen] if allow_redirects else []
File "C:\Dropbox\projects\Helpers\ph\.envwin32\lib\site-packages\requests\sessions.py", line 154, in resolve_redirects
allow_redirects=False,
File "C:\Dropbox\projects\Helpers\ph\.envwin32\lib\site-packages\requests\sessions.py", line 448, in send
r = adapter.send(request, **kwargs)
File "C:\Dropbox\projects\Helpers\ph\.envwin32\lib\site-packages\requests\adapters.py", line 318, in send
raise ConnectionError(e)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='servag.rupsy.ru', port=80): Max retries exceeded with url: /media/2/Haatzumaniak_-_Dark_Sadhu_[2013]/03. Haatzumaniak_-_777_Dark Sadhu 2013.mp3 (Caused by <class 'http.client.BadStatusLine'>: '')
Metadata
Metadata
Assignees
Labels
No labels