Click Download button to get file!
This post is about how to efficiently/correctly download files from URLs using Python. I will be using the god-send library requests for it. With the following streaming code, the Python memory usage is restricted regardless of the size of the downloaded file: def download_file(url): ... Downloading files from web using Python? Import module. import requests. Get the link or url. url = 'https://www.facebook.com/favicon.ico' r = requests.get(url, allow_redirects=True) Save the content with name.