From fc6ff82bed4cd9a83430e2d4bb97ce81397f1b64 Mon Sep 17 00:00:00 2001 From: DingZQ Date: Sat, 15 Oct 2022 17:49:03 +0800 Subject: [PATCH] Execute batch --- main.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index c978005..414257f 100644 --- a/main.py +++ b/main.py @@ -98,12 +98,13 @@ async def fastapi_sync_with_server(network: str, operationid: int) -> ChangeSet: @app.post("/batch/") async def fastapi_execute_batch_commands(network: str, req: Request)-> ChangeSet: - jsTxt = await req.json() - print(jsTxt) - print(type(jsTxt)) - jo = json.loads(jsTxt) - print(jo) - print(type(jo)) + jo_root = await req.json() + print(jo_root) + jo_operations = jo_root['operations'] + cs: ChangeSet = ChangeSet({}) + for jo in jo_operations: + cs.add(jo) + return execute_batch_commands(network, cs) # node @app.get("/getnodes/")