Add getnodes

This commit is contained in:
DingZQ
2022-09-14 23:08:42 +08:00
parent c304627c8e
commit 06c4b2f1c2

11
main.py
View File

@@ -72,15 +72,8 @@ async def fastapi_delete_project(network: str):
# element operations
@app.get("/getnodes/")
async def fastapi_get_nodes(network: str):
nodeCount = get_count(network, NODE_COUNT)
nodes = []
for i in range(nodeCount.value):
node_id = get_node_id(network, i + 1)
if node_id.error_code == 0:
nodes.append(node_id.value)
return nodes
async def fastapi_get_nodes(network: str) -> list[str]:
return get_nodes(network)
# junction
@app.post("/addjunction/")