mirror of
https://github.com/Bunsly/HomeHarvest.git
synced 2026-03-04 19:44:29 -08:00
Add last_update_date filtering and improve time interface DX
Part A: Add last_update_date filtering (client-side) - Add updated_since parameter (accepts datetime object or ISO string) - Add updated_in_past_hours parameter (accepts int or timedelta) - Implement _apply_last_update_date_filter() method for client-side filtering - Add mutual exclusion validation for updated_* parameters Part B: Improve time interface DX - Accept datetime/timedelta objects for datetime_from, datetime_to - Accept timedelta objects for past_hours, past_days - Add type conversion helper functions in utils.py - Improve validation error messages with specific examples - Update validate_datetime to accept datetime objects Helper functions added: - convert_to_datetime_string() - Converts datetime objects to ISO strings - extract_timedelta_hours() - Extracts hours from timedelta objects - extract_timedelta_days() - Extracts days from timedelta objects - validate_last_update_filters() - Validates last_update_date parameters All changes are backward compatible - existing string/int parameters still work. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,10 @@ class ScraperInput(BaseModel):
|
||||
datetime_from: str | None = None
|
||||
datetime_to: str | None = None
|
||||
|
||||
# New last_update_date filtering parameters
|
||||
updated_since: str | None = None
|
||||
updated_in_past_hours: int | None = None
|
||||
|
||||
# New property filtering parameters
|
||||
beds_min: int | None = None
|
||||
beds_max: int | None = None
|
||||
@@ -115,6 +119,10 @@ class Scraper:
|
||||
self.datetime_from = scraper_input.datetime_from
|
||||
self.datetime_to = scraper_input.datetime_to
|
||||
|
||||
# New last_update_date filtering
|
||||
self.updated_since = scraper_input.updated_since
|
||||
self.updated_in_past_hours = scraper_input.updated_in_past_hours
|
||||
|
||||
# New property filtering
|
||||
self.beds_min = scraper_input.beds_min
|
||||
self.beds_max = scraper_input.beds_max
|
||||
|
||||
Reference in New Issue
Block a user