Exemplo n.º 1
0
def _async_get_weather(period):
    global weather_and_traffic
    period = 5 * 60
    threading.Timer(period, _async_get_weather, [period]).start()

    weather_and_traffic = get_weather_and_traffic()
    print ("Query to yandex is done...")
Exemplo n.º 2
0
    def register_wakeup_time(self, origins, destinations, time, brekfast_time):
        global weather_and_traffic
        weather_and_traffic = get_weather_and_traffic()

        s = WakeupInfo("wakeup_info.json", origins, destinations, time, 0, brekfast_time)
        routing_info = self.get_routing_info(s.origins, s.destinations)
        print (routing_info)
        estimating_time = routing_info["rows"][0]["elements"][0]["duration"]["value"]
        s.estimating_time = timediff_to_humantime(estimating_time)
        status = s.save()
        if status == True:
            return "1"
        else:
            return "0"