From aa0a66fa0d13d870d470a5727853dcc8c340d234 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Thu, 11 Aug 2022 14:49:17 +0200 Subject: [PATCH] Fix weather cache holding data --- modules/weather_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/weather_api.py b/modules/weather_api.py index 52f6603..28964e4 100644 --- a/modules/weather_api.py +++ b/modules/weather_api.py @@ -26,7 +26,7 @@ class DarkSkyAPI: except: pass - if statinfo is None or datetime.fromtimestamp(statinfo.st_mtime, tz=timezone.utc) > datetime.now(tz=timezone.utc) + timedelta(hours=1): + if statinfo is None or datetime.fromtimestamp(statinfo.st_mtime, tz=timezone.utc) + timedelta(hours=1) < datetime.now(tz=timezone.utc): # Do the request and save it with urllib.request.urlopen(self.baseurl + "/" + str(self.apikey) + "/" + gps + "?" + "&".join([opt+"="+self.opts[opt] for opt in self.opts])) as f: with open(self._cached_file % gps, 'wb') as fd: