I am trying to download many images from a list of URLs.
When I use this code on just one image, it works fine.
img = Image.open(requests.get(url_dict[key], stream = True).raw)
img.save(f'images/{file_name}.jpg')
When I run it through the for loop below, it downloads a bunch of empty files with no extension.
Why?
How do I fix this?
for key in url_dict:
file_name = key.replace(' ', '_')
img = Image.open(requests.get(url_dict[key], stream = True).raw)
img.save(f'images/{file_name}.jpg')
I am expecting to get a folder full of images that actually contain data.