Skip to content

Instantly share code, notes, and snippets.

@IuryAlves
Created August 12, 2018 01:54
Show Gist options
  • Save IuryAlves/53ad8892d4e6c3defde07f1a25e6d734 to your computer and use it in GitHub Desktop.
Save IuryAlves/53ad8892d4e6c3defde07f1a25e6d734 to your computer and use it in GitHub Desktop.
# coding: utf-8
import requests
chunk_size = 1024 * 1024 # 1mb
download_url = 'http://speedtest.ftp.otenet.gr/files/test10Mb.db'
downloaded_parts = 0
with open('download', 'wb') as fp:
response = requests.get(download_url, stream=True)
for content in response.iter_content(chunk_size):
downloaded_parts +=1
fp.write(content)
print('#' * downloaded_parts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment