def __asyncRequestWeatherData(self):
success = False
self.lastRequestedWeatherQueryTime = time.time()
while not success:
if not self.__isAlive:
return
try:
self.__weatherInfo = hourlyForecast(WEATHER_LOCATION[0], WEATHER_LOCATION[1], wundergroundApiKey)
success = True
except:
success = False
currTime = datetime.now()
print("FAIL: Weather request at {:02d}:{:02d}:{:02d}".format(currTime.hour, currTime.minute, currTime.second))
currTime = datetime.now()
print("SUCCESS: Weather request at {:02d}:{:02d}:{:02d}".format(currTime.hour, currTime.minute, currTime.second))
self.lastSuccessfulWeatherQueryTime = time.time()
self.newWeatherDataAvailable = True
评论列表
文章目录