Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Limbicnation/94da3645c80b1ecf5d59b680c25de7d4 to your computer and use it in GitHub Desktop.
Save Limbicnation/94da3645c80b1ecf5d59b680c25de7d4 to your computer and use it in GitHub Desktop.
Download multiple images using Python
import requests
def DownloadImage(pic_url_prefix, pic_name):
with open(pic_name, 'wb') as handle:
response = requests.get(pic_url_prefix+pic_name, stream=True)
if not response.ok:
print(pic_url_prefix+pic_name, response)
for block in response.iter_content(1024):
if not block:
break
handle.write(block)
for i in range(367):
DownloadImage(
'<<YOUR URL HERE>>',
'<<YOUR IMAGE NAME HERE>>-{:03}.jpg'.format(i)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment