Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. >>> r = requests.get('https://www.dropbox.com/s/613jb9or3xfccsq/train.zip?dl=1', allow_redirects=False, stream=True)
  2. >>> r.headers['Content-Type']
  3. 'text/html; charset=utf-8'
  4. >>> r.headers['Content-Length']
  5. '0'
  6. >>> r.headers['Location']
  7. 'https://dl.dropboxusercontent.com/content_link/j2NG4qEKW1bZAmkhN9ey9YhbsLdFWhhLqsviPYCGpMBZilTC7C3330ZeZMpGHfcX/file?dl=1'
  8. >>> r.status_code
  9. 302
  10. >>> r2 = requests.get(r.headers['Location'], stream=True)
  11. >>> with open('ex.zip', 'wb') as fd:
  12. ... for chunk in r2.iter_content(chunk_size=1024):
  13. ... fd.write(chunk)
  14. ...
  15. >>>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement