Created
February 16, 2017 05:49
-
-
Save pawl/9cac6e18fd888063141d15aac15fc253 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import codecs | |
import requests | |
import time | |
# this could be different, but it works for my application, but the content-type definitely matters | |
fileHeaders = { | |
'Content-Type': 'application/octet-stream;charset=text/html;charset=UTF-8' | |
} | |
url = 'www.yourfile.com/your.zip' | |
with codecs.open('your.zip', mode='wb', encoding='utf-8') as handle: | |
zip_file = requests.get(url, headers=fileHeaders, prefetch=False) | |
for block in zip_file.iter_content(1024): | |
if block: | |
handle.write(block) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment