From 6e88f6e5a3e25dd7fe1bd51c36488c6de5dd1446 Mon Sep 17 00:00:00 2001 From: Michael Koeppl Date: Tue, 25 Jun 2024 09:08:53 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20bwsg=20scraper=20checks=20if=20'Wohnfl?= =?UTF-8?q?=C3=A4che'=20exists=20before=20using=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scrapers/impl/scraper_bwsg.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scrapers/impl/scraper_bwsg.py b/scrapers/impl/scraper_bwsg.py index ee01b08..9db388d 100644 --- a/scrapers/impl/scraper_bwsg.py +++ b/scrapers/impl/scraper_bwsg.py @@ -114,7 +114,8 @@ def bwsg_scraper(timerObj: func.TimerRequest, q: func.Out[str]) -> None: room_count = bwsg_description.get("Zimmer", None) listing["roomCount"] = int(room_count) if room_count is not None else None - square_meters = re.findall(r'(\d+[.,\d]*)', bwsg_description["Wohnfläche"]) + if "Wohnfläche" in bwsg_description: + square_meters = re.findall(r'(\d+[.,\d]*)', bwsg_description["Wohnfläche"]) listing["squareMeters"] = float(square_meters[0].replace(',', '.')) listing["availabilityDate"] = format_date(bwsg_description.get("Beziehbar", "")) listing["yearBuilt"] = int(bwsg_description.get("Baujahr", "-1"))