Skip to content

Instantly share code, notes, and snippets.

@tehmaze

tehmaze/wx.py

Created Apr 20, 2014
Embed
What would you like to do?
WX report generator for PyMultimonAPRS
#!/usr/bin/env python
import json
import pywapi
import sys
import time
LOCATION_ID = sys.argv[1]
wxs = pywapi.get_weather_from_weather_com('NLXX0250', 'metric')
cur = wxs['current_conditions']
out = dict(
timestamp=int(time.time()),
wind=dict(
gust=0,
direction=int(cur['wind']['direction']),
speed=float(cur['wind']['speed']),
),
pressure=float(cur['barometer']['reading']),
humidity=int(cur['humidity']),
temperature=float(cur['temperature']),
)
print json.dumps(out, indent=4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment