Skip to content

Instantly share code, notes, and snippets.

@j-thepac
Last active July 8, 2022 09:12
Show Gist options
  • Save j-thepac/410f8051702771537bed8ab37692c4a9 to your computer and use it in GitHub Desktop.
Save j-thepac/410f8051702771537bed8ab37692c4a9 to your computer and use it in GitHub Desktop.
download huge file as zip
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