Refine json for method getnodecoord

This commit is contained in:
DingZQ
2022-09-03 19:31:45 +08:00
parent cd8585ceca
commit c3b87db9ff

12
main.py
View File

@@ -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):