Sleepy Weim

Python: Fetch Image

Grabbing an image from a URL is fairly simple. In this script I create two string objects, define them with the URL, and then use the Retrieve method to save them into the folder.

They will be saved in the same location that the script runs, so make sure you have permission to write/save in that folder.

import urllib
import os

url_3DayPhilly = "https://www.nbcphiladelphia.com/assets/weather/wcau/3day1.png"
url_3DayShore = "https://www.nbcphiladelphia.com/assets/weather/wcau/3day2.png"

webimg = urllib.URLopener()
webimg.retrieve(url_3DayPhilly,"3day1.png")  
webimg.retrieve(url_3DayShore,"3day2.png")

2 thoughts on “Python: Fetch Image

Leave a Reply

Your email address will not be published. Required fields are marked *