Skip to content

Commit

Permalink
- agent mls set and nrds id
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacharyHampton committed Aug 23, 2024
1 parent 32fdc28 commit 1010c74
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 2 deletions.
2 changes: 2 additions & 0 deletions homeharvest/core/scrapers/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ class Entity:

@dataclass
class Agent(Entity):
mls_set: str | None = None
nrds_id: str | None = None
phones: list[dict] | AgentPhone | None = None
email: str | None = None
href: str | None = None
Expand Down
4 changes: 3 additions & 1 deletion homeharvest/core/scrapers/realtor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ def _parse_fulfillment_id(fulfillment_id: str | None) -> str | None:
advertiser_type = advertiser.get("type")
if advertiser_type == "seller": #: agent
processed_advertisers.agent = Agent(
uuid=advertiser.get("mls_set"),
uuid=_parse_fulfillment_id(advertiser.get("fulfillment_id")),
nrds_id=advertiser.get("nrds_id"),
mls_set=advertiser.get("mls_set"),
name=advertiser.get("name"),
email=advertiser.get("email"),
phones=advertiser.get("phones"),
Expand Down
1 change: 1 addition & 0 deletions homeharvest/core/scrapers/realtor/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
fulfillment_id
}
mls_set
nrds_id
rental_corporation {
fulfillment_id
}
Expand Down
4 changes: 4 additions & 0 deletions homeharvest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
"agent_name",
"agent_email",
"agent_phones",
"agent_mls_set",
"agent_nrds_id",
"broker_id",
"broker_name",
"builder_id",
Expand Down Expand Up @@ -81,6 +83,8 @@ def process_result(result: Property) -> pd.DataFrame:
prop_data["agent_name"] = agent_data.name
prop_data["agent_email"] = agent_data.email
prop_data["agent_phones"] = agent_data.phones
prop_data["agent_mls_set"] = agent_data.mls_set
prop_data["agent_nrds_id"] = agent_data.nrds_id

if advertiser_data.broker:
broker_data = advertiser_data.broker
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.4.0"
version = "0.4.1"
description = "Real estate scraping library"
authors = ["Zachary Hampton <[email protected]>", "Cullen Watson <[email protected]>"]
homepage = "https://github.com/Bunsly/HomeHarvest"
Expand Down
10 changes: 10 additions & 0 deletions tests/test_realtor.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,13 @@ def test_apartment_list_price():
assert len(results[results[["list_price", "list_price_min", "list_price_max"]].notnull().any(axis=1)]) / len(
results
) > 0.5


def test_builder_exists():
listing = scrape_property(
location="18149 W Poston Dr, Surprise, AZ 85387",
extra_property_data=False,
)

assert listing is not None
assert listing["builder_name"].nunique() > 0

0 comments on commit 1010c74

Please sign in to comment.