Apixu changed name to weatherstack
This commit is contained in:
parent
c4435e3cbf
commit
4d7b6725af
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Reference in New Issue