Fix weather cache holding data
This commit is contained in:
parent
0d87588870
commit
aa0a66fa0d
@ -26,7 +26,7 @@ class DarkSkyAPI:
|
|||||||
except:
|
except:
|
||||||
pass
|
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
|
# 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 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:
|
with open(self._cached_file % gps, 'wb') as fd:
|
||||||
|
Loading…
Reference in New Issue
Block a user