- agent mls set and nrds id

pull/102/head v0.4.1
Zachary Hampton 2024-08-23 10:47:45 -07:00
parent 32fdc281e3
commit 1010c743b6
6 changed files with 21 additions and 2 deletions

View File

@ -97,6 +97,8 @@ class Entity:
@dataclass @dataclass
class Agent(Entity): class Agent(Entity):
mls_set: str | None = None
nrds_id: str | None = None
phones: list[dict] | AgentPhone | None = None phones: list[dict] | AgentPhone | None = None
email: str | None = None email: str | None = None
href: str | None = None href: str | None = None

View File

@ -114,7 +114,9 @@ class RealtorScraper(Scraper):
advertiser_type = advertiser.get("type") advertiser_type = advertiser.get("type")
if advertiser_type == "seller": #: agent if advertiser_type == "seller": #: agent
processed_advertisers.agent = 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"), name=advertiser.get("name"),
email=advertiser.get("email"), email=advertiser.get("email"),
phones=advertiser.get("phones"), phones=advertiser.get("phones"),

View File

@ -109,6 +109,7 @@ _SEARCH_HOMES_DATA_BASE = """{
fulfillment_id fulfillment_id
} }
mls_set mls_set
nrds_id
rental_corporation { rental_corporation {
fulfillment_id fulfillment_id
} }

View File

@ -46,6 +46,8 @@ ordered_properties = [
"agent_name", "agent_name",
"agent_email", "agent_email",
"agent_phones", "agent_phones",
"agent_mls_set",
"agent_nrds_id",
"broker_id", "broker_id",
"broker_name", "broker_name",
"builder_id", "builder_id",
@ -81,6 +83,8 @@ def process_result(result: Property) -> pd.DataFrame:
prop_data["agent_name"] = agent_data.name prop_data["agent_name"] = agent_data.name
prop_data["agent_email"] = agent_data.email prop_data["agent_email"] = agent_data.email
prop_data["agent_phones"] = agent_data.phones 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: if advertiser_data.broker:
broker_data = advertiser_data.broker broker_data = advertiser_data.broker

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "homeharvest" name = "homeharvest"
version = "0.4.0" version = "0.4.1"
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"

View File

@ -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( assert len(results[results[["list_price", "list_price_min", "list_price_max"]].notnull().any(axis=1)]) / len(
results results
) > 0.5 ) > 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