Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# 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
You can’t perform that action at this time.