Beispiel #1
0
    def getWeather(self,address):

        fullLocName,lat,lng = self.getLoaction(address)
        
        if fullLocName != None:
            webWeather = ServerCaller("https://api.forecast.io/forecast/0e75783f8a3fa4de5b49fff8115d93b4/"+str(lat)+","+str(lng))
            webWeather.callService()
            
            currently = Weather("Currently",webWeather.data["currently"])   
            return currently.getWeatherInfo(fullLocName)
        
        else:
            return "(wtf) - 404 Location not found!"
Beispiel #2
0
 def getLoaction(self,address):
     
     url = "http://maps.googleapis.com/maps/api/geocode/json?address="+address+"&sensor=false"
     
     location = ServerCaller(url)
     location.callService()
     
     if location.data["status"] == "OK":
         fullLocName = location.data["results"][0]["formatted_address"]
         lat = location.data["results"][0]["geometry"]["location"]["lat"]
         lng = location.data["results"][0]["geometry"]["location"]["lng"]
         return fullLocName,lat,lng
     else:
         return None,None,None