Retrieve weather data from Norwegian Meteorological Institute's APIs easily.
yr-weather
is an API wrapper for some of the products from MET's API.
To see an example on how these APIs can be used, take a look at Yr, made by MET and NRK.
Available on PyPI:
Supported products are:
- Locationforecast (v2.0)
- Radar (v2.0)
- Textforecast (v2.0)
- Sunrise (v3.0)
- Geosatellite (v1.4)
This package requires Python 3.8 or newer. To download the newest version, visit Python's website.
To use yr-weather
, simply install it using pip
.
For Windows:
pip install yr-weather
For Linux/macOS:
python3 -m pip install yr-weather
To get started, check out the documentation.
For specific API Products, check their separate section on the documentation:
For the best developer experience, all functions and classes are typed and documented with docstrings.
By default, the library makes a cache file named yr_cache.sqlite
in the working directory.
To disable caching, set use_cache
to False
like so:
yr_weather.Locationforecast(headers=headers, use_cache=False)
MET's Terms of Service encourage using caching to avoid extra load on the network. Therefore, disabling caching and not implementing it yourself is not recommended.
This project is licensed under the Apache License 2.0.
yr-weather
is not associated with yr.no or the Norwegian Meteorological Institute (MET).
Any usage of the APIs provided by MET must follow their API Terms of Service.