add live requests to all valid routes

This commit is contained in:
Hannes Klinckaert 2019-10-02 13:22:51 +02:00
parent f226a4e51a
commit 7916873589
1 changed files with 6 additions and 2 deletions

View File

@ -38,6 +38,8 @@ def index():
@app.route("/start_run/<run_index>")
def start_run(run_index):
request_data = live_request(f'/start_run/{run_index}') #make request show up on the live requests
if not run_index.isdigit():
return f'{run_index} is not a number'
@ -53,7 +55,7 @@ def start_run(run_index):
@app.route("/link/start/<run>/<link_index>")
def link_start(run, link_index):
request_data = live_request(run, link_index, f'/link/start/{run}/{link_index}') #make request show up on the live requests
request_data = live_request(f'/link/start/{run}/{link_index}') #make request show up on the live requests
if not run.isdigit() or not link_index.isdigit():
return f'{run} and/or {link_index} is not a number'
@ -79,6 +81,8 @@ def link_start(run, link_index):
@app.route("/link/handoff/<run>/<index>")
def link_handoff(run, index):
request_data = live_request(f'/link/handoff/{run}/{link_index}') #make request show up on the live requests
if not run.isdigit() or not index.isdigit():
return f'{run} and/or {index} is not a number'
@ -101,7 +105,7 @@ def connect(sid, data):
sio.emit('sync_current_run', current_run, room=sid)
def live_request(run, index, route_data):
def live_request(route_data):
ip = request.remote_addr
request_data = {}
request_data["hostname"] = lookup_hostname(ip)