Skip to content

Instantly share code, notes, and snippets.

@erika-dike
Last active June 28, 2017 09:30
Show Gist options
  • Save erika-dike/ab1b502bcf0da2a008ba05fabadef8db to your computer and use it in GitHub Desktop.
Save erika-dike/ab1b502bcf0da2a008ba05fabadef8db to your computer and use it in GitHub Desktop.
Auto download of images on a site
import requests
def download_images(prefix, dirname, links):
length = len(links)
for index, link in enumerate(links):
print 'Downloading {0} of {1} images'.format(index + 1, length)
url = prefix + link
response = requests.get(url, stream=True)
save_image_to_file(response, dirname, index)
del response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment