add scraping functionality for Lipsia and improve error handling for image downloads

This commit is contained in:
Elmar Kresse
2025-01-13 11:57:20 +01:00
parent 1093f49438
commit b2ef4eb5f2
13 changed files with 58 additions and 5 deletions

View File

@@ -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}