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.

Revisions

  1. Dmitrii K revised this gist Dec 15, 2018. No changes.
  2. Dmitrii K revised this gist Feb 15, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion requests_download_file.py
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    import requests
    import shutil

    r = requests.get(settings.STATICMAP_URL.format(**data), stream=True)
    r = requests.get('url', stream=True)
    if r.status_code == 200:
    with open(path, 'wb') as f:
    r.raw.decode_content = True
  3. Dmitrii K created this gist Feb 15, 2018.
    8 changes: 8 additions & 0 deletions requests_download_file.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    import requests
    import shutil

    r = requests.get(settings.STATICMAP_URL.format(**data), stream=True)
    if r.status_code == 200:
    with open(path, 'wb') as f:
    r.raw.decode_content = True
    shutil.copyfileobj(r.raw, f)