Skip to content

Instantly share code, notes, and snippets.

@dmitriiweb
Last active December 15, 2018 05:02
Show Gist options
  • Select an option

  • Save dmitriiweb/c89040799577c75c893ac51775139fad to your computer and use it in GitHub Desktop.

Select an option

Save dmitriiweb/c89040799577c75c893ac51775139fad to your computer and use it in GitHub Desktop.
requests shutil download file
import requests
import shutil
r = requests.get('url', stream=True)
if r.status_code == 200:
with open(path, 'wb') as f:
r.raw.decode_content = True
shutil.copyfileobj(r.raw, f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment