Skip to content

Commit

Permalink
enh: agent on inv listings
Browse files Browse the repository at this point in the history
  • Loading branch information
cullenwatson committed Apr 16, 2024
1 parent e2819b7 commit f294416
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion homeharvest/core/scrapers/realtor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,16 @@ 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=(
property_info["source"].get("listing_id")
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,
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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,
Expand All @@ -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,
)
]

Expand Down

0 comments on commit f294416

Please sign in to comment.