

When the URL linked to a webpage rather than a binary, I had to not download that file and just keep the link as is. This was one of the problems I faced in the Import module of Open Event where I had to download media from certain links.

If you said that a HTML page will be downloaded, you are spot on. What do you think will happen if the above code is used to download it ? Now let's take another example where url is. The above code will download the media at and save it as google.ico. Open( 'google.ico', 'wb').write(r.content) R = requests.get(url, allow_redirects= True)

Let's start with baby steps on how to download a file using requests - import requests I will write about methods to correctly download binaries from URLs and set their filenames. I will be using the god-send library requests for it. This post is about how to efficiently/correctly download files from URLs using Python.
