Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> r = requests.get('https://www.dropbox.com/s/613jb9or3xfccsq/train.zip?dl=1', allow_redirects=False, stream=True)
- >>> r.headers['Content-Type']
- 'text/html; charset=utf-8'
- >>> r.headers['Content-Length']
- '0'
- >>> r.headers['Location']
- 'https://dl.dropboxusercontent.com/content_link/j2NG4qEKW1bZAmkhN9ey9YhbsLdFWhhLqsviPYCGpMBZilTC7C3330ZeZMpGHfcX/file?dl=1'
- >>> r.status_code
- 302
- >>> r2 = requests.get(r.headers['Location'], stream=True)
- >>> with open('ex.zip', 'wb') as fd:
- ... for chunk in r2.iter_content(chunk_size=1024):
- ... fd.write(chunk)
- ...
- >>>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement