Skip to content

Commit

Permalink
- rename to property
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacharyHampton committed Sep 16, 2023
1 parent 4764b6b commit a772fe4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions homeharvest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .core.scrapers.redfin import RedfinScraper
from .core.scrapers.realtor import RealtorScraper
from .core.scrapers.types import ListingType, Home
from .core.scrapers.types import ListingType, Property
from .core.scrapers import ScraperInput
from .exceptions import InvalidSite, InvalidListingType

Expand All @@ -15,7 +15,7 @@ def scrape_property(
location: str,
site_name: str,
listing_type: str = "for_sale", #: for_sale, for_rent, sold
) -> list[Home]: #: eventually, return pandas dataframe
) -> list[Property]: #: eventually, return pandas dataframe
if site_name.lower() not in _scrapers:
raise InvalidSite(f"Provided site, '{site_name}', does not exist.")

Expand Down
6 changes: 3 additions & 3 deletions homeharvest/core/scrapers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from dataclasses import dataclass
import requests
from .types import Home, ListingType
from .types import Property, ListingType


@dataclass
Expand All @@ -21,9 +21,9 @@ def __init__(self, scraper_input: ScraperInput):
"https": scraper_input.proxy_url,
}

def search(self) -> list[Home]: ...
def search(self) -> list[Property]: ...

@staticmethod
def parse_home(home) -> Home: ...
def parse_home(home) -> Property: ...

def handle_location(self): ...
2 changes: 1 addition & 1 deletion homeharvest/core/scrapers/realtor/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import json
from ..types import Home, Address
from ..types import Property, Address
from .. import Scraper
from typing import Any

Expand Down
6 changes: 3 additions & 3 deletions homeharvest/core/scrapers/redfin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import json
from ..types import Home, Address
from ..types import Property, Address
from .. import Scraper
from typing import Any

Expand All @@ -20,7 +20,7 @@ def handle_location(self):
return response_json['payload']['sections'][0]['rows'][0].split('_')[1]

@staticmethod
def parse_home(home: dict) -> Home:
def parse_home(home: dict) -> Property:
address = Address(
address_one=home['streetLine']['value'],
city=home['city'],
Expand All @@ -34,7 +34,7 @@ def get_value(key: str) -> Any | None:
if key in home and 'value' in home[key]:
return home[key]['value']

return Home(
return Property(
address=address,
url=url,
beds=home['beds'] if 'beds' in home else None,
Expand Down
2 changes: 1 addition & 1 deletion homeharvest/core/scrapers/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Address:


@dataclass
class Home:
class Property:
address: Address
url: str

Expand Down

0 comments on commit a772fe4

Please sign in to comment.