A small Python library for interacting with the MET Norway Weather API.
pip install normetapi
from normetapi import location_forecast
# Get forecast for Trondheim:
forecast = location_forecast(63.4107, 10.4538)
print(forecast)
The forecast will be returned as a dictionary. See the description of locationforecast and the data model in the MET Norway Weather API description.
from normetapi import nowcast
# Get nowcast for Trondheim:
forecast = nowcast(63.4107, 10.4538, altitude=123)
print(forecast)
The forecast will be returned as a dictionary. See the description of nowcast and the data model in the MET Norway Weather API description.
from normetapi import weathericon
# Get icons:
_, legend = weathericon(output_file='icons.tgz')
print(legend)
This will download weather icons as a gzipped tar archive and return legends as a dictionary. See the description of weathericon in the MET Norway Weather API description.
Please read the terms of service. In particular, to quote the terms of service:
All requests must (if possible) include an identifying User Agent-string (UA) in the request with the application/domain name, optionally version number.
Please modify the USER_AGENT
variable in api.py to fit your
intended use.