예제 #1
0
 def Retrieve_Update_Weather(self):
     search_template = "http://api.openweathermap.org/data/2.5/" + "weather?q={},{}&units=metrics" + "&APPID=46dc006c130ecf6e18c0d33dffbd39da"
     get_weather_data = search(self.location, search_template)
     data = get_weather_data   
     if data:        
         self.conditions = data['weather'][0]['description']
         self.temp = data['main']['temp']
         self.temp_min = data['main']['temp_min']
         self.temp_max = data['main']['temp_max']  
예제 #2
0
 def search_location(self):
     '''this method retrieves the location entred by the user, insert it in the openweather api url and then pass it to request() class to fetch the information which is then pass to json()class for decoding'''
 
     search_template = "http://api.openweathermap.org/data/2.5/"+"find?q={}&type=like"+"&APPID=46dc006c130ecf6e18c0d33dffbd39da"
     
     #implents the search function module and search  user input 
     search_location_data = search((self.search_input.text,), search_template)
     data = search_location_data
     if data:
         cities = [(d["name"], d["sys"]["country"]) for d in data['list']]
         print (cities)
         self.search_results.adapter.data[:]
         self.search_results.adapter.data.extend(cities)
         self.search_results._reset_spopulate()
예제 #3
0
    def search_location(self):

        search_template = "http://api.openweathermap.org/data/2.5/" + "find?q={}&type=like" + "&APPID=46dc006c130ecf6e18c0d33dffbd39da"

        #implents the search function module and search  user input
        search_location_data = search((self.ids.CityToSearch.text, ),
                                      search_template)
        data = search_location_data
        if data:
            cities = [{
                "location": (d["name"], d["sys"]["country"])
            } for d in data['list']]
            del self.search_results.data[:]
            self.search_results.data = cities
        '''Wdata = JsonStore('weatherdata.json')