fix spaces in city name

This commit is contained in:
Brian S. Stephan 2010-12-09 13:09:01 -06:00
parent 914e86d567
commit 5a81f4d1fc
1 changed files with 2 additions and 1 deletions

View File

@ -22,6 +22,7 @@ import re
from extlib import irclib from extlib import irclib
from extlib import pywapi from extlib import pywapi
from urllib import quote
from urllib2 import URLError from urllib2 import URLError
from Module import Module from Module import Module
@ -35,7 +36,7 @@ class Weather(Module):
whats = what.split(' ') whats = what.split(' ')
if whats[0] == "weather" and len(whats) >= 2: if whats[0] == "weather" and len(whats) >= 2:
try: try:
google_weather = pywapi.get_weather_from_google(''.join(whats[1:])) google_weather = pywapi.get_weather_from_google(quote(' '.join(whats[1:])))
city = google_weather['forecast_information']['city'].encode('utf-8') city = google_weather['forecast_information']['city'].encode('utf-8')
condition = google_weather['current_conditions']['condition'].encode('utf-8') condition = google_weather['current_conditions']['condition'].encode('utf-8')
temp_f = google_weather['current_conditions']['temp_f'].encode('utf-8') temp_f = google_weather['current_conditions']['temp_f'].encode('utf-8')