Guest User

Untitled

a guest
Jul 20th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. import requests
  2. import shutil
  3.  
  4. def download_file(url):
  5. local_filename = url.split('/')[-1]
  6. r = requests.get(url, stream=True)
  7. with open(local_filename, 'wb') as f:
  8. shutil.copyfileobj(r.raw, f)
  9.  
  10. return local_filename
Add Comment
Please, Sign In to add comment