mirror of
https://gitlab.dit.htwk-leipzig.de/fsr-im/tools/flatscraper.git
synced 2025-07-26 00:09:14 +02:00
add scraping functionality for Lipsia and improve error handling for image downloads
This commit is contained in:
@@ -33,6 +33,13 @@ def send_to_discord(property_data):
|
||||
# Download the image
|
||||
image_response = scrape_image.scrape_image(property_data["image_url"])
|
||||
|
||||
# Check if the image was downloaded successfully
|
||||
if image_response == b"":
|
||||
print("Fehler beim Herunterladen des Bildes: Leere Antwort")
|
||||
payload = {"content": message}
|
||||
response = requests.post(WEBHOOK_URL, data=json.dumps(payload), headers=headers)
|
||||
return
|
||||
|
||||
# Send the message with an image attachment
|
||||
files = {"file": ("image.jpg", image_response)}
|
||||
payload = {"content": message}
|
||||
|
Reference in New Issue
Block a user