Skip to content

Commit

Permalink
- rewrote & optimized flow
Browse files Browse the repository at this point in the history
- new_construction data point
- renamed "agent" & "broker" to "agent_name" & "broker_name"
- added builder & office data
- added entity uuids
  • Loading branch information
ZacharyHampton committed Aug 20, 2024
1 parent 6d14b8d commit 32fdc28
Show file tree
Hide file tree
Showing 7 changed files with 416 additions and 485 deletions.
27 changes: 19 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Optional
├── proxy (string): In format 'http://user:pass@host:port'
├── extra_property_data (True/False): Increases requests by O(n). If set, this fetches additional property data (e.g. agent, broker, property evaluations etc.)
├── extra_property_data (True/False): Increases requests by O(n). If set, this fetches additional property data for general searches (e.g. schools, tax appraisals etc.)
├── exclude_pending (True/False): If set, excludes pending properties from the results unless listing_type is 'pending'
Expand Down Expand Up @@ -123,6 +123,7 @@ Property
│ ├── sqft
│ ├── year_built
│ ├── stories
│ ├── garage
│ └── lot_sqft
├── Property Listing Details:
Expand All @@ -135,29 +136,39 @@ Property
│ ├── sold_price
│ ├── last_sold_date
│ ├── price_per_sqft
│ ├── parking_garage
│ ├── new_construction
│ └── hoa_fee
├── Location Details:
│ ├── latitude
│ ├── longitude
│ ├── nearby_schools
├── Agent Info:
│ ├── agent
│ ├── agent_id
│ ├── agent_name
│ ├── agent_email
│ └── agent_phone
├── Broker Info:
│ ├── broker
│ ├── broker_email
│ └── broker_website
│ ├── broker_id
│ └── broker_name
├── Builder Info:
│ ├── builder_id
│ └── builder_name
├── Office Info:
│ ├── office_id
│ ├── office_name
│ ├── office_phones
│ └── office_email
```

### Exceptions
The following exceptions may be raised when using HomeHarvest:

- `InvalidListingType` - valid options: `for_sale`, `for_rent`, `sold`
- `InvalidListingType` - valid options: `for_sale`, `for_rent`, `sold`, `pending`.
- `InvalidDate` - date_from or date_to is not in the format YYYY-MM-DD.
- `AuthenticationError` - Realtor.com token request failed.
40 changes: 32 additions & 8 deletions homeharvest/core/scrapers/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,41 @@ class AgentPhone: #: For documentation purposes only (at the moment)


@dataclass
class Agent:
name: str | None = None
class Entity:
name: str
uuid: str | None = None


@dataclass
class Agent(Entity):
phones: list[dict] | AgentPhone | None = None
email: str | None = None
href: str | None = None


@dataclass
class Broker:
name: str | None = None
phone: str | None = None
website: str | None = None
class Office(Entity):
email: str | None = None
href: str | None = None
phones: list[dict] | AgentPhone | None = None


@dataclass
class Broker(Entity):
pass


@dataclass
class Builder(Entity):
pass


@dataclass
class Advertisers:
agent: Agent | None = None
broker: Broker | None = None
builder: Builder | None = None
office: Office | None = None


@dataclass
Expand All @@ -120,6 +143,7 @@ class Property:
pending_date: str | None = None
last_sold_date: str | None = None
prc_sqft: int | None = None
new_construction: bool | None = None
hoa_fee: int | None = None
days_on_mls: int | None = None
description: Description | None = None
Expand All @@ -129,8 +153,8 @@ class Property:
neighborhoods: Optional[str] = None
county: Optional[str] = None
fips_code: Optional[str] = None
agents: list[Agent] | None = None
brokers: list[Broker] | None = None
nearby_schools: list[str] = None
assessed_value: int | None = None
estimated_value: int | None = None

advertisers: Advertisers | None = None
Loading

0 comments on commit 32fdc28

Please sign in to comment.