Download image using urllib


Usually you will want to save the downloaded image to the local disk.

examples/web-client/download_image_with_urllib.py
import urllib.request

url = 'https://www.python.org/images/python-logo.gif'
with urllib.request.urlopen(url) as fh:
    with open('logo.gif', 'wb') as out:
        out.write(fh.read())