Sunrise: API Reference#
- class yr_weather.Sunrise(headers: dict | None = {}, use_cache: bool | None = True)#
Bases:
BaseClientA client for interacting with the Yr Sunrise API.
- get_detail(detail: Literal['high_moon', 'low_moon', 'moonphase', 'solarmidnight', 'solarnoon', 'moonrise', 'moonset', 'sunrise', 'sunset', 'moonposition', 'moonshadow'], date: str, lat: float, lon: float, offset: str, height: float | None = None) dict#
Get data about the specified event or detail.
This will get the newest sunrise data, and return the event/detail dict, if available. For more information, please see: https://api.met.no/weatherapi/sunrise/2.0/documentation
- Parameters:
detail (
DetailLiteral) – The detail/event to get data for. Must be one of the following: “high_moon”, “low_moon”, “moonphase”, “solarmidnight”, “solarnoon”, “moonrise”, “moonset”, “sunrise”, “sunset”, “moonposition”, “moonshadow”date (
str) – A date formatted in ISO 8601 format, like so: YYYY-MM-DD.offset (
str) – The timezone offset, given in the following format: +/-HH:MM.height (Optional[
float|int]) – The altitude above the ellipsoid in kilometers (km).
- Returns:
Details about the chosen event or detail.
- Return type:
- get_sunrise(date: str, lat: float, lon: float, offset: str, days_forward: int | None = None, height: float | None = None) SunriseData#
Get sunrise data.
For more information, please see: https://api.met.no/weatherapi/sunrise/2.0/documentation
- Parameters:
date (
str) – A date formatted in ISO 8601 format, like so: YYYY-MM-DD.offset (
str) – The timezone offset, given in the following format: +HH:MM or -HH:MM.days_forward (
int) – The number of future days which should be included.height (Optional[
float|int]) – The altitude above the ellipsoid in kilometers (km).
- Returns:
A typed dict containing sunrise data.
- Return type: