I'm trying to open an image at a URL using Pillow, but it only works for some URL. In my code below, URL1 works but not URL2.
import requests
from PIL import Image
url1 = "/200"
# url2 = ".jpg"
image = Image.open(requests.get(url, stream=True, verify=False).raw)
If I run the code with URL2, it gives me an error:
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x...>
I am able to open both URLs with my browser so I'm really curious as to why. Are there any methods that will work on both?
Thanks