A few tweaks to plugins: weather.py now uses web.query for YQL, spellcheck.py has some renamed variables and uses new string formatting, choose.py has a nicer fail message.

This commit is contained in:
Luke Rogers 2012-10-13 14:02:22 +13:00
parent de67aad764
commit 5f0d5f62a2
3 changed files with 13 additions and 17 deletions

View file

@ -1,16 +1,13 @@
from util import hook
import yql as YQL
from util import hook, web
def get_weather(location):
"""uses the yahoo weather API to get weather information for a location"""
yql = YQL.Public()
enviroment = "http://datatables.org/alltables.env"
query = "SELECT * FROM weather.bylocation WHERE location=@location LIMIT 1"
data = yql.execute(query, {"location": location}, env=enviroment).one()
result = web.query(query, {"location": location})
data = data["rss"]["channel"]
data = result.rows[0]["rss"]["channel"]
# wind conversions
data['wind']['chill_c'] = int(round((int(data['wind']['chill']) - 32) / 1.8, 0))