732e7edba4
Signed-off-by: Markus Birth <markus@birth-online.de>
33 lines
912 B
Python
33 lines
912 B
Python
from microdot import Microdot
|
|
from microdot.utemplate import Template
|
|
import tflcountdown as tfl
|
|
|
|
# utemplate doc: https://github.com/pfalcon/utemplate
|
|
|
|
API_KEY = "NOT_YET_REQUIRED"
|
|
# Stop-IDs from https://tfl.gov.uk/bus-stops.csv
|
|
STOP_IDS = {
|
|
"Acton Vale (N)": "1597",
|
|
"Acton Vale (S)": "1598",
|
|
"Abinger Road (N)": "11333",
|
|
"Abinger Road (S)": "11334"
|
|
|
|
#H1227,58839,490018676N,Hail & Ride Larden Road,521409,179656,350,6408,1
|
|
#H1228,N/A,490018676S,Hail & Ride Larden Road,521420,179655,170,6408,1
|
|
}
|
|
LINE_IDS = {
|
|
"272": "272"
|
|
}
|
|
|
|
app = Microdot()
|
|
tflc = tfl.TflCountdown(API_KEY)
|
|
|
|
@app.route("/")
|
|
async def index(request):
|
|
response = tflc.get_countdown(["1597", "1598", "11333", "11334", "R0199"])
|
|
data = tflc.parse_countdown(response.text)
|
|
print(repr(data))
|
|
return Template("index.html").render(data), {"Content-Type": "text/html"}
|
|
|
|
app.run(port=5001, debug=True)
|