return "Weather is not enabled - please set the API key in the config file"
if place is not None:
- weather = json.load(urlopen(('http://api.weatherstack.com/current?access_key=%s&query=%s' % (lib.parent.cfg.get('weatherstack_weather', 'key'), quote_plus(place))).encode('utf8')))
+ url = 'http://api.weatherstack.com/current?access_key=%s&query=%s' % (lib.parent.cfg.get('weatherstack_weather', 'key'), quote_plus(place))
+ if sys.version_info.major < 3:
+ url = url.encode('utf8')
+ weather = json.load(urlopen(url))
if lib.parent.cfg.getboolean('debug', 'weather'):
lib.parent.log('*', "?", repr(weather))
if 'error' in weather: