mirror of
https://github.com/Bunsly/HomeHarvest.git
synced 2026-03-05 03:54:29 -08:00
- base
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
from dataclasses import dataclass
|
||||
import requests
|
||||
from .types import Home, ListingType
|
||||
|
||||
|
||||
@dataclass
|
||||
class ScraperInput:
|
||||
location: str
|
||||
listing_type: ListingType
|
||||
proxy_url: str | None = None
|
||||
|
||||
|
||||
class Scraper:
|
||||
def __init__(self, scraper_input: ScraperInput):
|
||||
self.location = scraper_input.location
|
||||
self.session = requests.Session()
|
||||
|
||||
if scraper_input.proxy_url:
|
||||
self.session.proxies = {
|
||||
"http": scraper_input.proxy_url,
|
||||
"https": scraper_input.proxy_url,
|
||||
}
|
||||
|
||||
def search(self) -> list[Home]:
|
||||
...
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
from .. import Scraper
|
||||
|
||||
|
||||
class RedfinScraper(Scraper):
|
||||
def __init__(self, scraper_input):
|
||||
super().__init__(scraper_input)
|
||||
|
||||
23
homeharvest/core/scrapers/types.py
Normal file
23
homeharvest/core/scrapers/types.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class ListingType(Enum):
|
||||
FOR_SALE = "for_sale"
|
||||
FOR_RENT = "for_rent"
|
||||
SOLD = "sold"
|
||||
|
||||
|
||||
@dataclass
|
||||
class Address:
|
||||
address_one: str
|
||||
city: str
|
||||
state: str
|
||||
zip_code: str
|
||||
|
||||
address_two: str | None = None
|
||||
|
||||
|
||||
@dataclass
|
||||
class Home:
|
||||
address: Address
|
||||
Reference in New Issue
Block a user