enh: add agent (#68)

pull/69/head^2 v0.3.17
Cullen Watson 2024-04-16 15:09:32 -05:00 committed by GitHub
parent cdc6f2a2a8
commit 6076b0f961
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -141,6 +141,8 @@ class RealtorScraper(Scraper):
if days_on_mls and days_on_mls < 0: if days_on_mls and days_on_mls < 0:
days_on_mls = None days_on_mls = None
property_id = property_info["details"]["permalink"]
agents = self.get_agents(property_id)
listing = Property( listing = Property(
mls=mls, mls=mls,
mls_id=( mls_id=(
@ -148,7 +150,7 @@ class RealtorScraper(Scraper):
if "source" in property_info and isinstance(property_info["source"], dict) if "source" in property_info and isinstance(property_info["source"], dict)
else None 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(), status=property_info["basic"]["status"].upper(),
list_price=property_info["basic"]["price"], list_price=property_info["basic"]["price"],
list_date=list_date, list_date=list_date,
@ -176,6 +178,7 @@ class RealtorScraper(Scraper):
stories=property_info["details"].get("stories"), stories=property_info["details"].get("stories"),
), ),
days_on_mls=days_on_mls, days_on_mls=days_on_mls,
agents=agents,
) )
return [listing] return [listing]
@ -269,6 +272,7 @@ class RealtorScraper(Scraper):
}""" }"""
variables = {"property_id": property_id} variables = {"property_id": property_id}
agents = self.get_agents(property_id)
payload = { payload = {
"query": query, "query": query,
@ -286,6 +290,7 @@ class RealtorScraper(Scraper):
property_url=f"{self.PROPERTY_URL}{property_info['details']['permalink']}", property_url=f"{self.PROPERTY_URL}{property_info['details']['permalink']}",
address=self._parse_address(property_info, search_type="handle_address"), address=self._parse_address(property_info, search_type="handle_address"),
description=self._parse_description(property_info), description=self._parse_description(property_info),
agents=agents,
) )
] ]

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "homeharvest" name = "homeharvest"
version = "0.3.16" version = "0.3.17"
description = "Real estate scraping library" description = "Real estate scraping library"
authors = ["Zachary Hampton <zachary@bunsly.com>", "Cullen Watson <cullen@bunsly.com>"] authors = ["Zachary Hampton <zachary@bunsly.com>", "Cullen Watson <cullen@bunsly.com>"]
homepage = "https://github.com/Bunsly/HomeHarvest" homepage = "https://github.com/Bunsly/HomeHarvest"