Refine json for method getnodecoord
This commit is contained in:
12
main.py
12
main.py
@@ -117,12 +117,16 @@ async def fastapi_count_node(network: str):
|
|||||||
|
|
||||||
@app.get("/getnodecoord/")
|
@app.get("/getnodecoord/")
|
||||||
async def fastapi_get_node_coord(network: str, node: str):
|
async def fastapi_get_node_coord(network: str, node: str):
|
||||||
pt = []
|
|
||||||
value = get_node_coord(network, node).value
|
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/")
|
@app.post("/setnodecoord/")
|
||||||
async def fastapi_set_node_coord(network: str, node: str, x: int, y: int):
|
async def fastapi_set_node_coord(network: str, node: str, x: int, y: int):
|
||||||
|
|||||||
Reference in New Issue
Block a user