weather
weather
¶
Weather connector — current conditions and forecast via OpenWeatherMap API.
Uses an API key stored in the connector config dir. All API calls are in module-level functions for easy mocking in tests.
Classes¶
WeatherAPIError
¶
Bases: RuntimeError
A credential-safe error returned by the OpenWeatherMap API.
WeatherConnector
¶
Bases: BaseConnector
Fetch current weather and short-term forecast from OpenWeatherMap.
Source code in src/openjarvis/connectors/weather.py
Functions¶
stored_api_key
¶
Return the stored connector key, or None when unavailable.
Source code in src/openjarvis/connectors/weather.py
configure
¶
Validate and persist the API key and required location.
Source code in src/openjarvis/connectors/weather.py
sync
¶
sync(*, since: Optional[datetime] = None, cursor: Optional[str] = None) -> Iterator[Document]
Yield Documents for current weather and forecast.
Source code in src/openjarvis/connectors/weather.py
Functions¶
fetch_weather
¶
fetch_weather(*, api_key: str, location: str, units: str, language: str, include_forecast: bool = False, forecast_count: int = 8) -> tuple[Dict[str, Any], Dict[str, Any] | None]
Fetch weather for a caller-provided location from fixed API endpoints.