feat: flight price monitor with Kiwi adapter stub and cron setup
- config.json: BER→EZE route, €700 threshold, 14-28 nights, Dec-Mar preferred - monitor.py: config-driven, multi-route, windowed date search, openclaw alerts - adapters/base.py: abstract FlightAdapter interface - adapters/kiwi.py: Kiwi/Tequila v2 adapter (stub until KIWI_API_KEY is set) - requirements.txt, cron-install.sh (daily 08:00 UTC), README.md
This commit is contained in:
42
adapters/base.py
Normal file
42
adapters/base.py
Normal file
@@ -0,0 +1,42 @@
|
||||
"""Base adapter interface for flight price sources."""
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class FlightAdapter(ABC):
|
||||
"""Abstract base class for flight search adapters.
|
||||
|
||||
All adapters must return a list of flight result dicts with keys:
|
||||
price_eur (float) - total round-trip price in EUR
|
||||
outbound_date (str) - departure date YYYY-MM-DD
|
||||
return_date (str) - return date YYYY-MM-DD
|
||||
deep_link (str) - booking URL
|
||||
carrier (str) - airline name or IATA code
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def search(
|
||||
self,
|
||||
origin: str,
|
||||
destination: str,
|
||||
date_from: str,
|
||||
date_to: str,
|
||||
min_nights: int,
|
||||
max_nights: int,
|
||||
) -> list[dict]:
|
||||
"""Search for round-trip flights.
|
||||
|
||||
Args:
|
||||
origin: IATA airport/city code (e.g. "BER")
|
||||
destination: IATA airport/city code (e.g. "EZE")
|
||||
date_from: Earliest outbound date, YYYY-MM-DD
|
||||
date_to: Latest outbound date, YYYY-MM-DD
|
||||
min_nights: Minimum stay duration
|
||||
max_nights: Maximum stay duration
|
||||
|
||||
Returns:
|
||||
List of result dicts (may be empty). Sorted by price ascending
|
||||
is preferred but not required.
|
||||
"""
|
||||
...
|
||||
Reference in New Issue
Block a user