Update every 30 seconds; adding a link to the station info page.

This commit is contained in:
Christian Lawson-Perfect 2025-05-11 09:09:38 +00:00
parent 3f68f9ae72
commit e6c92a3edf
3 changed files with 25 additions and 16 deletions

View file

@ -22,7 +22,7 @@ data_root.mkdir(exist_ok=True)
fname = data_root / f'{station}-{platform}.json'
if (not fname.exists()) or (datetime.now() - datetime.fromtimestamp(fname.stat().st_mtime) > timedelta(minutes=1)):
if (not fname.exists()) or (datetime.now() - datetime.fromtimestamp(fname.stat().st_mtime) > timedelta(seconds=20)):
req = requests.get(f'https://metro-rti.nexus.org.uk/api/times/{station}/{platform}')
with open(fname, 'w') as f:
f.write(req.text)