From c25961ededcfe2d7e694b57a92a53b29e6e6b3ef Mon Sep 17 00:00:00 2001 From: Cullen Watson Date: Thu, 21 Sep 2023 13:06:06 -0500 Subject: [PATCH] fix: KeyEror : [minBaths] --- homeharvest/core/scrapers/zillow/__init__.py | 10 +++++----- pyproject.toml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/homeharvest/core/scrapers/zillow/__init__.py b/homeharvest/core/scrapers/zillow/__init__.py index 217e824..c3139db 100644 --- a/homeharvest/core/scrapers/zillow/__init__.py +++ b/homeharvest/core/scrapers/zillow/__init__.py @@ -198,18 +198,18 @@ class ZillowScraper(Scraper): site_name=self.site_name, property_type=PropertyType("BUILDING"), listing_type=ListingType(result["statusType"]), - img_src=result["imgSrc"], + img_src=result.get("imgSrc"), address=self._extract_address(result["address"]), - baths_min=result["minBaths"], + baths_min=result.get("minBaths"), area_min=result.get("minArea"), bldg_name=result.get("communityName"), status_text=result["statusText"], beds_min=result["minBeds"], price_min=price_value if "+/mo" in result["price"] else None, price_max=price_value if "+/mo" in result["price"] else None, - latitude=result["latLong"]["latitude"], - longitude=result["latLong"]["longitude"], - unit_count=result["unitCount"], + latitude=result.get("latLong", {}).get("latitude"), + longitude=result.get("latLong", {}).get("longitude"), + unit_count=result.get("unitCount"), ) properties_list.append(building_obj) diff --git a/pyproject.toml b/pyproject.toml index 9bd1af5..326a8ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "homeharvest" -version = "0.2.10" +version = "0.2.11" description = "Real estate scraping library supporting Zillow, Realtor.com & Redfin." authors = ["Zachary Hampton ", "Cullen Watson "] homepage = "https://github.com/ZacharyHampton/HomeHarvest"