Apixu changed name to weatherstack

This commit is contained in:
Pedro de Oliveira 2019-12-05 21:27:27 +00:00
parent c4435e3cbf
commit 4d7b6725af
1 changed files with 9 additions and 9 deletions

View File

@ -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(