save image requests python

import requests

url = ''
r = requests.get(url, allow_redirects=True)
open('google.ico', 'wb').write(r.content)

Here is what the above code is Doing:
1. We’re using the requests library to fetch the contents of the URL.
2. We’re using the allow_redirects parameter to tell requests to automatically handle redirects.
3. We’re using the open function to create a file called google.ico and write the contents of the response to the file.