Jump to content

Download Component


tokejepsen

Recommended Posts

Hey Mattias,

Thanks, works:)

Modified the code from this nice thread: https://stackoverflow.com/questions/16694907/how-to-download-large-file-in-python-with-requests-py

 

def download_file(url, path):
    r = requests.get(url, stream=True)
    with open(path, 'wb') as f:
        for chunk in r.iter_content(chunk_size=1024): 
            if chunk:
                f.write(chunk)
    if os.path.exists(path):
        return True
    else:
        return False

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...