Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Download File Common Function
- def download_file(url, path):
- local_filename = url.split('/')[-1]
- # NOTE the stream=True parameter
- r = requests.get(url, stream=True)
- with open(local_filename, 'wb') as f:
- for chunk in r.iter_content(chunk_size=1024):
- if chunk: # filter out keep-alive new chunks
- f.write(chunk)
- #f.flush() commented by recommendation from J.F.Sebastian
- shutil.move(local_filename,path+'/'+local_filename)
Add Comment
Please, Sign In to add comment