Last active
July 8, 2022 09:12
-
-
Save j-thepac/410f8051702771537bed8ab37692c4a9 to your computer and use it in GitHub Desktop.
download huge file as zip
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
from http.client import IncompleteRead | |
import requests | |
path="/Documents/test.zip" | |
with requests.get(url, headers=headers, stream=True) as r: | |
with open(path, 'wb') as f: | |
while(True): | |
try: | |
f.write(r.content) | |
break | |
except IncompleteRead:continue | |
print("written", path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment