for i, image in enumerate(img_element):
with open(‘inspiration{}.jpg’.format(i),‘wb’) as file:
img_url=image.img.attrs[‘src’]
response=requests.get(img_url)
file.write(response.content)
and i am getting this error
AttributeError Traceback (most recent call last)
in
1 for i, image in enumerate(img_element):
2 with open(‘inspiration{}.jpg’.format(i),‘wb’) as file:
----> 3 img_url=image.img.attrs[‘src’]
4 response=requests.get(img_url)
5
AttributeError: ‘NoneType’ object has no attribute ‘attrs’