Skip to content

Commit

Permalink
enh: add agent (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
cullenwatson authored Apr 16, 2024
1 parent cdc6f2a commit 6076b0f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "homeharvest"
version = "0.3.16"
version = "0.3.17"
description = "Real estate scraping library"
authors = ["Zachary Hampton <[email protected]>", "Cullen Watson <[email protected]>"]
homepage = "https://github.com/Bunsly/HomeHarvest"
Expand Down

0 comments on commit 6076b0f

Please sign in to comment.