From 106db094747c8a7ae2ceddde471329c4286567bc Mon Sep 17 00:00:00 2001 From: DingZQ Date: Sat, 12 Nov 2022 19:20:42 +0800 Subject: [PATCH] Refine status api --- main.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index 406a56f..db1401a 100644 --- a/main.py +++ b/main.py @@ -886,15 +886,15 @@ async def fastapi_set_demand_properties(network: str, junction: str, req: Reques async def fast_get_status_schema(network: str) -> dict[str, dict[str, Any]]: return get_status_schema(network) -@app.get("/getstatusproperties/") -async def fastapi_get_status_properties(network: str, demand: str) -> dict[str, Any]: - return get_status(network, demand) +@app.get("/getstatus/") +async def fastapi_get_status(network: str, link: str) -> dict[str, Any]: + return get_status(network, link) # example: set_status(p, ChangeSet({'link': 'p0', 'status': LINK_STATUS_OPEN, 'setting': 10.0})) -@app.post("/setstatusproperties/") -async def fastapi_set_status_properties(network: str, status: str, req: Request) -> ChangeSet: +@app.post("/setstatus/") +async def fastapi_set_status_properties(network: str, link: str, req: Request) -> ChangeSet: props = await req.json() - ps = { 'id' : status } | props + ps = { 'id' : link } | props return set_status(network, ChangeSet(ps)) ############################################################