Skip to content

Instantly share code, notes, and snippets.

@mvpotter
Created February 19, 2014 09:08
Show Gist options
  • Save mvpotter/9088499 to your computer and use it in GitHub Desktop.
Save mvpotter/9088499 to your computer and use it in GitHub Desktop.
Download large files using python
def download_file(url):
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()
return local_filename
@metin02oktay
Copy link

Hi ı want to download large files 10mb parts with this code but encode base64 write in txt file.

eg: 10gb a rar file, url; http://....../10gb.rar

10gb-part1.txt(10mb) - 10gb-part2.txt(10mb) - 10gb-part3.txt(10mb) - .....

can somebody help me :D thanks

@hossainel
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment