From f294416136ac083e01c97515a3e0f89d9d6b6de8 Mon Sep 17 00:00:00 2001 From: Cullen Date: Tue, 16 Apr 2024 15:05:18 -0500 Subject: [PATCH] enh: agent on inv listings --- homeharvest/core/scrapers/realtor/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/homeharvest/core/scrapers/realtor/__init__.py b/homeharvest/core/scrapers/realtor/__init__.py index bc0c5c0..3f22e8b 100644 --- a/homeharvest/core/scrapers/realtor/__init__.py +++ b/homeharvest/core/scrapers/realtor/__init__.py @@ -141,6 +141,8 @@ def handle_listing(self, listing_id: str) -> list[Property]: if days_on_mls and days_on_mls < 0: days_on_mls = None + property_id = property_info["details"]["permalink"] + agents = self.get_agents(property_id) listing = Property( mls=mls, mls_id=( @@ -148,7 +150,7 @@ def handle_listing(self, listing_id: str) -> list[Property]: if "source" in property_info and isinstance(property_info["source"], dict) else None ), - property_url=f"{self.PROPERTY_URL}{property_info['details']['permalink']}", + property_url=f"{self.PROPERTY_URL}{property_id}", status=property_info["basic"]["status"].upper(), list_price=property_info["basic"]["price"], list_date=list_date, @@ -176,6 +178,7 @@ def handle_listing(self, listing_id: str) -> list[Property]: stories=property_info["details"].get("stories"), ), days_on_mls=days_on_mls, + agents=agents, ) return [listing] @@ -269,6 +272,7 @@ def handle_address(self, property_id: str) -> list[Property]: }""" variables = {"property_id": property_id} + agents = self.get_agents(property_id) payload = { "query": query, @@ -286,6 +290,7 @@ def handle_address(self, property_id: str) -> list[Property]: property_url=f"{self.PROPERTY_URL}{property_info['details']['permalink']}", address=self._parse_address(property_info, search_type="handle_address"), description=self._parse_description(property_info), + agents=agents, ) ]