HomeHarvest/homeharvest/core/scrapers/models.py

71 lines
1.5 KiB
Python
Raw Normal View History

2023-09-15 15:17:37 -07:00
from dataclasses import dataclass
from enum import Enum
2023-10-03 22:21:16 -07:00
from typing import Optional
2023-09-15 15:17:37 -07:00
2023-09-17 16:30:37 -07:00
class SiteName(Enum):
ZILLOW = "zillow"
REDFIN = "redfin"
REALTOR = "realtor.com"
@classmethod
def get_by_value(cls, value):
for item in cls:
if item.value == value:
return item
raise ValueError(f"{value} not found in {cls}")
2023-09-17 16:30:37 -07:00
2023-09-15 15:17:37 -07:00
class ListingType(Enum):
2023-09-18 11:38:17 -07:00
FOR_SALE = "FOR_SALE"
FOR_RENT = "FOR_RENT"
SOLD = "SOLD"
2023-09-15 15:17:37 -07:00
@dataclass
class Address:
2023-10-03 22:21:16 -07:00
street: str | None = None
unit: str | None = None
2023-09-19 19:13:20 -07:00
city: str | None = None
state: str | None = None
2023-10-03 22:21:16 -07:00
zip: str | None = None
2023-09-15 15:17:37 -07:00
@dataclass
class Agent:
name: str
phone: str | None = None
email: str | None = None
2023-09-18 11:38:17 -07:00
@dataclass
class Property:
2023-10-03 22:21:16 -07:00
property_url: str | None = None
mls: str | None = None
2023-09-15 16:03:17 -07:00
mls_id: str | None = None
2023-10-03 22:21:16 -07:00
status: str | None = None
style: str | None = None
beds: int | None = None
baths_full: int | None = None
baths_half: int | None = None
list_price: int | None = None
list_date: str | None = None
sold_price: int | None = None
last_sold_date: str | None = None
prc_sqft: float | None = None
est_sf: int | None = None
lot_sf: int | None = None
hoa_fee: int | None = None
address: Address | None = None
yr_blt: int | None = None
2023-09-19 19:13:20 -07:00
latitude: float | None = None
longitude: float | None = None
2023-10-03 22:21:16 -07:00
stories: int | None = None
prkg_gar: float | None = None
neighborhoods: Optional[str] = None