Add fastapi for import inp and export inp
This commit is contained in:
11
main.py
11
main.py
@@ -74,6 +74,17 @@ async def fastapi_copy_project(source: str, target: str):
|
||||
copy_project(source, target)
|
||||
return True
|
||||
|
||||
@app.post("/importinp/")
|
||||
async def fastapi_import_inp(network: str, req: Request):
|
||||
jo_root = await req.json()
|
||||
cs: ChangeSet = ChangeSet()
|
||||
cs.operations = jo_root['inp']
|
||||
return import_inp(network, cs)
|
||||
|
||||
@app.get("/exportinp/")
|
||||
async def fastapi_export_inp(network: str):
|
||||
return export_inp(network)
|
||||
|
||||
@app.post("/readinp/")
|
||||
async def fastapi_read_inp(network: str, inp: str) -> bool:
|
||||
read_inp(network, inp)
|
||||
|
||||
Reference in New Issue
Block a user