Update every 30 seconds; adding a link to the station info page.
This commit is contained in:
parent
3f68f9ae72
commit
e6c92a3edf
3 changed files with 25 additions and 16 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue