From 4d7b6725af305258ef1312e09341d16461e858b5 Mon Sep 17 00:00:00 2001 From: Pedro de Oliveira Date: Thu, 5 Dec 2019 21:27:27 +0000 Subject: [PATCH] Apixu changed name to weatherstack --- Apixu/plugin.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Apixu/plugin.py b/Apixu/plugin.py index d32b61b..a9dcf44 100644 --- a/Apixu/plugin.py +++ b/Apixu/plugin.py @@ -43,16 +43,16 @@ import requests class Apixu(callbacks.Plugin): - """apixu weather api client""" + """weatherstack weather api client""" threaded = True def __init__(self, irc): self.__parent = super(Apixu, self) self.__parent.__init__(irc) - self.prepend = "8,12Apixu" + self.prepend = "8,12weatherstack" def __do_request(self, action, arguments): - baseurl = "https://api.apixu.com/v1/" + baseurl = "http://api.weatherstack.com/" response = requests.get(baseurl + action + "?" + urlencode(arguments)) return json.loads(response.content.decode('utf-8')) @@ -61,9 +61,9 @@ class Apixu(callbacks.Plugin): data['location']['name'], data['location']['region'], data['location']['country'], - data['current']['temp_c'], - data['current']['condition']['text'], - data['current']['last_updated'], + data['current']['temperature'], + ",".join(data['current']['weather_descriptions']), + data['current']['observation_time'], ) def current(self, irc, msg, args, location): @@ -77,10 +77,10 @@ class Apixu(callbacks.Plugin): return data = self.__do_request( - 'current.json', + 'current', { - 'key': key, - 'q': location + 'access_key': key, + 'query': location }) irc.reply("{} {}".format(