Added image placeholder if cant retrieve it
This commit is contained in:
@@ -21,10 +21,13 @@ def add_product(tg_user, tg_group, tg_user_id, tg_group_id, url, referurl, title
|
||||
con.commit()
|
||||
con.close()
|
||||
|
||||
response = requests.get(image, headers=constants.HEADERS)
|
||||
file = open(f"/app/data/images/products/{product_id}.jpg", "wb")
|
||||
file.write(response.content)
|
||||
file.close()
|
||||
try:
|
||||
response = requests.get(image, headers=constants.HEADERS)
|
||||
file = open(f"/app/data/images/products/{product_id}.jpg", "wb")
|
||||
file.write(response.content)
|
||||
file.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
return product_id
|
||||
|
||||
|
||||
Reference in New Issue
Block a user