Beispiel #1
0
class WeatherReport:
    def __init__(self, appid, lang='zh_cn', base_url='http://api.openweathermap.org'):
        self.__appid = appid
        self.__lang = lang
        self.__restful_client = RestfulClient(base_url)

    def report_weather(self, city):
        param = {'appid': self.__appid, 'lang': self.__lang, 'q': city}
        return self.__restful_client.request_get('/data/2.5/weather', param)
Beispiel #2
0
 def __init__(self, appid, lang='zh_cn', base_url='http://api.openweathermap.org'):
     self.__appid = appid
     self.__lang = lang
     self.__restful_client = RestfulClient(base_url)