Compare commits

...

5 Commits

Author SHA1 Message Date
Zachary Hampton
ccf5786ce2 Merge pull request #127 from Alexandre-Shofstall/fix/python39-compat
Fix typing syntax for Python 3.9 compatibility in __init__.py
2025-07-03 09:43:26 -07:00
Zachary Hampton
b4f05b254a Update pyproject.toml 2025-07-03 09:43:10 -07:00
Alexandre Shofstall
941d1081f7 Fix typing syntax for Python 3.9 compatibility in __init__.py 2025-07-03 18:11:18 +02:00
Zachary Hampton
c788b3318d Update README.md 2025-06-19 16:52:14 -07:00
zachary
68a3438c6e - single home return type bug fix 2025-05-05 12:29:36 -07:00
5 changed files with 16 additions and 12 deletions

View File

@@ -8,8 +8,6 @@
- **Data Format**: Structures data to resemble MLS listings.
- **Export Flexibility**: Options to save as either CSV or Excel.
[Video Guide for HomeHarvest](https://youtu.be/J1qgNPgmSLI) - _updated for release v0.3.4_
![homeharvest](https://github.com/ZacharyHampton/HomeHarvest/assets/78247585/b3d5d727-e67b-4a9f-85d8-1e65fd18620a)
## Installation

View File

@@ -4,13 +4,13 @@ from .core.scrapers import ScraperInput
from .utils import process_result, ordered_properties, validate_input, validate_dates, validate_limit
from .core.scrapers.realtor import RealtorScraper
from .core.scrapers.models import ListingType, SearchPropertyType, ReturnType, Property
from typing import Optional, List
def scrape_property(
location: str,
listing_type: str = "for_sale",
return_type: str = "pandas",
property_type: list[str] | None = None,
property_type: Optional[List[str]] = None,
radius: float = None,
mls_only: bool = False,
past_days: int = None,

View File

@@ -121,7 +121,10 @@ class RealtorScraper(Scraper):
property_info = response_json["data"]["home"]
return [self.process_property(property_info)]
if self.return_type != ReturnType.raw:
return [self.process_property(property_info)]
else:
return [property_info]
@staticmethod
def process_advertisers(advertisers: list[dict] | None) -> Advertisers | None:

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "homeharvest"
version = "0.4.8"
version = "0.4.10"
description = "Real estate scraping library"
authors = ["Zachary Hampton <zachary@bunsly.com>", "Cullen Watson <cullen@bunsly.com>"]
homepage = "https://github.com/Bunsly/HomeHarvest"

View File

@@ -292,11 +292,14 @@ def test_phone_number_matching():
def test_return_type():
results = {
"pandas": scrape_property(location="Surprise, AZ", listing_type="for_rent", limit=100),
"pydantic": scrape_property(location="Surprise, AZ", listing_type="for_rent", limit=100, return_type="pydantic"),
"raw": scrape_property(location="Surprise, AZ", listing_type="for_rent", limit=100, return_type="raw"),
"pandas": [scrape_property(location="Surprise, AZ", listing_type="for_rent", limit=100)],
"pydantic": [scrape_property(location="Surprise, AZ", listing_type="for_rent", limit=100, return_type="pydantic")],
"raw": [
scrape_property(location="Surprise, AZ", listing_type="for_rent", limit=100, return_type="raw"),
scrape_property(location="66642", listing_type="for_rent", limit=100, return_type="raw"),
],
}
assert isinstance(results["pandas"], pd.DataFrame)
assert isinstance(results["pydantic"][0], Property)
assert isinstance(results["raw"][0], dict)
assert all(isinstance(result, pd.DataFrame) for result in results["pandas"])
assert all(isinstance(result[0], Property) for result in results["pydantic"])
assert all(isinstance(result[0], dict) for result in results["raw"])