- rename to property
parent
4764b6bd37
commit
a772fe45aa
|
@ -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
|
||||
|
||||
|
@ -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.")
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from dataclasses import dataclass
|
||||
import requests
|
||||
from .types import Home, ListingType
|
||||
from .types import Property, ListingType
|
||||
|
||||
|
||||
@dataclass
|
||||
|
@ -21,9 +21,9 @@ class Scraper:
|
|||
"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): ...
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import json
|
||||
from ..types import Home, Address
|
||||
from ..types import Property, Address
|
||||
from .. import Scraper
|
||||
from typing import Any
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import json
|
||||
from ..types import Home, Address
|
||||
from ..types import Property, Address
|
||||
from .. import Scraper
|
||||
from typing import Any
|
||||
|
||||
|
@ -20,7 +20,7 @@ class RedfinScraper(Scraper):
|
|||
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'],
|
||||
|
@ -34,7 +34,7 @@ class RedfinScraper(Scraper):
|
|||
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,
|
||||
|
|
|
@ -19,7 +19,7 @@ class Address:
|
|||
|
||||
|
||||
@dataclass
|
||||
class Home:
|
||||
class Property:
|
||||
address: Address
|
||||
url: str
|
||||
|
||||
|
|
Loading…
Reference in New Issue