download jpg from url python requests code example
Example 1: download image python
import urllib.request
image_url = 'https://bit.ly/2XuVzB4' #the image on the web
save_name = 'my_image.jpg' #local name to be saved
urllib.request.urlretrieve(image_url, save_name)
Example 2: save image requests python
import requests
url = 'http://google.com/favicon.ico'
r = requests.get(url, allow_redirects=True)
open('google.ico', 'wb').write(r.content)