feat: initial flight monitor

- Python flight price monitor for BER↔EZE and other routes
- Adapter pattern for extensibility (Kiwi/Tequila implemented)
- OpenClaw alerting integration
- Cron-friendly one-shot execution
- Full logging of all checks
- Graceful handling when API key not set

Implements monkey-island/flight-monitor#2
This commit is contained in:
2026-03-21 23:10:25 +00:00
parent 96d2c6f67c
commit 30ee5fbd85
12 changed files with 588 additions and 2 deletions

54
adapters/base.py Normal file
View File

@@ -0,0 +1,54 @@
"""
Base adapter interface for flight price sources.
"""
from abc import ABC, abstractmethod
from datetime import date
from typing import List, Dict, Any
class FlightAdapter(ABC):
"""
Abstract base class for flight price adapters.
Each adapter implements a specific price source (Kiwi, Google Flights, etc.)
and returns results in a normalized format.
"""
@abstractmethod
def search_round_trip(
self,
origin: str,
destination: str,
departure_date: date,
return_date: date,
**kwargs
) -> List[Dict[str, Any]]:
"""
Search for round-trip flights.
Args:
origin: IATA code of origin airport (e.g., "BER")
destination: IATA code of destination airport (e.g., "EZE")
departure_date: Departure date
return_date: Return date
**kwargs: Adapter-specific parameters
Returns:
List of results, each with:
{
"price_eur": float,
"airline": str,
"departure": datetime,
"return": datetime,
"link": str (booking URL),
"source": str (adapter name)
}
Returns empty list if no results found.
"""
pass
@abstractmethod
def get_name(self) -> str:
"""Return the name of this adapter."""
pass