X-Git-Url: https://jfr.im/git/erebus.git/blobdiff_plain/4d8427458a6c049d50fd1cb49f258856a9cd1486..587ee5ca427717878944762beb20d3c10933835a:/modules/weatherstack_weather.py diff --git a/modules/weatherstack_weather.py b/modules/weatherstack_weather.py index a79ff78..937f1dc 100644 --- a/modules/weatherstack_weather.py +++ b/modules/weatherstack_weather.py @@ -53,7 +53,10 @@ def _weather(place): 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: