mirror of
https://github.com/Bunsly/HomeHarvest.git
synced 2026-03-04 19:44:29 -08:00
Consolidate date_from/date_to parameters - remove datetime_from/datetime_to
Simplified the time filtering interface by consolidating datetime_from/datetime_to into date_from/date_to with automatic precision detection. Changes: - Remove datetime_from and datetime_to parameters (confusing to have both) - Update date_from/date_to to accept multiple formats: - Date strings: "2025-01-20" (day precision) - Datetime strings: "2025-01-20T14:30:00" (hour precision) - date objects: date(2025, 1, 20) (day precision) - datetime objects: datetime(2025, 1, 20, 9, 0) (hour precision) - Add detect_precision_and_convert() helper to automatically detect precision - Add date_from_precision and date_to_precision fields to track precision level - Update filtering logic to use precision fields instead of separate parameters - Update README to remove datetime_from/datetime_to examples - Update validation to accept ISO datetime strings Benefits: - Single, intuitive parameter name (date_from/date_to) - Automatic precision detection based on input format - Reduced API surface area and cognitive load - More Pythonic - accept multiple input types All changes are backward compatible for existing date_from/date_to string usage. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
23
README.md
23
README.md
@@ -83,8 +83,8 @@ properties = scrape_property(
|
||||
properties = scrape_property(
|
||||
location="Dallas, TX",
|
||||
listing_type="for_sale",
|
||||
datetime_from="2025-01-20T09:00:00",
|
||||
datetime_to="2025-01-20T17:00:00"
|
||||
date_from="2025-01-20T09:00:00", # Hour precision automatically detected
|
||||
date_to="2025-01-20T17:00:00"
|
||||
)
|
||||
```
|
||||
|
||||
@@ -230,8 +230,8 @@ properties = scrape_property(
|
||||
properties = scrape_property(
|
||||
location="Phoenix, AZ",
|
||||
listing_type="for_sale",
|
||||
datetime_from=datetime.now() - timedelta(days=7),
|
||||
datetime_to=datetime.now(),
|
||||
date_from=datetime.now() - timedelta(days=7), # datetime object - hour precision
|
||||
date_to=datetime.now(),
|
||||
limit=100
|
||||
)
|
||||
```
|
||||
@@ -313,13 +313,14 @@ Optional
|
||||
│
|
||||
├── date_from, date_to (string): Start and end dates to filter properties listed or sold, both dates are required.
|
||||
| (use this to get properties in chunks as there's a 10k result limit)
|
||||
│ Format for both must be "YYYY-MM-DD".
|
||||
│ Example: "2023-05-01", "2023-05-15" (fetches properties listed/sold between these dates)
|
||||
│
|
||||
├── datetime_from, datetime_to (string): ISO 8601 datetime strings for hour-precise filtering. Uses client-side filtering.
|
||||
│ Format: "YYYY-MM-DDTHH:MM:SS" or "YYYY-MM-DD"
|
||||
│ Example: "2025-01-20T09:00:00", "2025-01-20T17:00:00" (fetches properties between 9 AM and 5 PM)
|
||||
│ Note: Cannot be used together with date_from/date_to
|
||||
│ Accepts multiple formats with automatic precision detection:
|
||||
│ - Date strings: "YYYY-MM-DD" (day precision)
|
||||
│ - Datetime strings: "YYYY-MM-DDTHH:MM:SS" (hour precision, uses client-side filtering)
|
||||
│ - date objects: date(2025, 1, 20) (day precision)
|
||||
│ - datetime objects: datetime(2025, 1, 20, 9, 0) (hour precision)
|
||||
│ Examples:
|
||||
│ Day precision: "2023-05-01", "2023-05-15"
|
||||
│ Hour precision: "2025-01-20T09:00:00", "2025-01-20T17:00:00"
|
||||
│
|
||||
├── beds_min, beds_max (integer): Filter by number of bedrooms
|
||||
│ Example: beds_min=2, beds_max=4 (2-4 bedrooms)
|
||||
|
||||
Reference in New Issue
Block a user