From c3b87db9ff2ec29afb9be4fe07f31bda770c3341 Mon Sep 17 00:00:00 2001 From: DingZQ Date: Sat, 3 Sep 2022 19:31:45 +0800 Subject: [PATCH] Refine json for method getnodecoord --- main.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 5230c4f..d50971e 100644 --- a/main.py +++ b/main.py @@ -117,12 +117,16 @@ async def fastapi_count_node(network: str): @app.get("/getnodecoord/") async def fastapi_get_node_coord(network: str, node: str): - pt = [] value = get_node_coord(network, node).value - pt.append(value.x) - pt.append(value.y) - return pt + return JSONResponse( + status_code = status.HTTP_200_OK, + content = + { + 'x': value.x, + 'y': value.y + } + ) @app.post("/setnodecoord/") async def fastapi_set_node_coord(network: str, node: str, x: int, y: int):