style: clean up whitespace and formatting in main.py and webhook.py

This commit is contained in:
Elmar Kresse
2025-08-15 15:17:35 +02:00
parent 2c8cea7645
commit 401eafcca5
2 changed files with 8 additions and 9 deletions

View File

@@ -1,4 +1,3 @@
from bs4 import BeautifulSoup
import json
import time
import src.wogetra.scraper as wogetra_scraper
@@ -14,6 +13,7 @@ TARGET_URL = "https://www.wogetra.de/immobilien-vermarktungsart/miete/"
# Store known property IDs to avoid duplicate notifications
known_properties = set()
# Main loop to periodically check for new listings
def main():
global known_properties
@@ -47,8 +47,7 @@ def main():
properties_vlw = vlw_scraper.scrape_vlw()
print("Scraped " + str(len(properties_vlw)) + " properties from VLW")
properties = properties_vlw
properties += properties_vlw
for prop in properties:
if prop["id"] not in known_properties:
@@ -56,7 +55,6 @@ def main():
localwebhook.send_to_discord(prop)
known_properties.add(prop["id"])
# save known properties to file
with open("known_properties.json", "w") as file:
json.dump(list(known_properties), file)
@@ -65,5 +63,6 @@ def main():
print("Waiting for the next check...")
time.sleep(300) # Check every 5 minutes
if __name__ == "__main__":
main()

View File

@@ -8,6 +8,7 @@ load_dotenv()
# Webhook URL from Discord
WEBHOOK_URL = os.getenv("WEBHOOK_URL")
# Funktion: Nachricht an Discord senden
def send_to_discord(property_data):
@@ -23,7 +24,6 @@ def send_to_discord(property_data):
f"**Beschreibung:** {property_data['abstract']}"
)
# Set headers
headers = {"Content-Type": "application/json"}