csparpa / pyowm

A Python wrapper around the OpenWeatherMap web API
https://pyowm.readthedocs.io
MIT License
791 stars 175 forks source link

Implement support for UV index API subset #93

Closed csparpa closed 8 years ago

csparpa commented 8 years ago

The OpenWeatherMap API also provides UV indexes data for locations all over the world:

http://openweathermap.org/api_uv

PyOWM should support this feature as well

csparpa commented 8 years ago

Usage:

uvi = owm.uvindex_around_coords(lat, lon)  # Get current UV Index on these coordinates
uvi.get_value()  # 4.2
uvi.get_exposure_risk() # 'moderate'

# Get available UV Index in the last 24 hours and last month
uvi = owm.uvindex_around_coords(lat, lon, start=timeutils.yesterday(), interval='day')
uvi = owm.uvindex_around_coords(lat, lon, start=timeutils.last_month(), interval='month') 
# interval can be: minute, hour, day, month, year