Simon PainterSomewhere to keep things

Python framework for

I wanted to use as a quick source for weather forecast data so put together a simple class to get at the properties I needed. As my needs changed I decided to implement the whole (very simple) api. You’ll need an api key but that’s about it.

Here’s a few things you can do with it:

import darksky
#import time

#next_hour = int(time.time()+3600)
latitude = “51.5026959”
longitude = “-0.1508741”
apikey = “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”

list_exclude = [“minutely”, “hourly”, “daily”, “flags”,”alerts”]
forecast = darksky.Forecast(apikey)
forecast.set(exclude = list_exclude)
#forecast.set(time = next_hour)

now = forecast.get(latitude,longitude)
print(‘Weather Summary: {summary}’.format(**now[‘currently’]))
print(‘Temperature: {temperature}’.format(**now[‘currently’]))
print(‘Feels like: {apparentTemperature}’.format(**now[‘currently’]))
print(‘Humidity: {humidity}’.format(**now[‘currently’]))

Tags: ,

Comments are currently closed.