Skip to content

Commit d031e3d

Browse files
committed
library api created
1 parent a1d7477 commit d031e3d

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

fri/server/main.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,30 @@ def destroy(dir):
347347
resp = jsonify({'message': 'There is an Error'})
348348
resp.status_code = 500
349349
return resp
350+
351+
@app.route('/library/<dir>', methods=['POST'])
352+
def library(dir):
353+
dir_name = secure_filename(dir)
354+
dir_path = os.path.abspath(os.path.join(concore_path, dir_name))
355+
filename = request.args.get('filename')
356+
library_path = request.args.get('path')
357+
proc = 0
358+
if (library_path == None or library_path == ''):
359+
library_path = "../tools"
360+
if(platform.uname()[0]=='Windows'):
361+
proc = subprocess.check_output(["..\library", library_path, filename],shell=True, cwd=dir_path)
362+
else:
363+
proc = subprocess.check_output(["../library", library_path, filename], cwd=dir_path)
364+
if(proc != 0):
365+
resp = jsonify({'message': proc.decode("utf-8")})
366+
resp.status_code = 201
367+
return resp
368+
else:
369+
resp = jsonify({'message': 'There is an Error'})
370+
resp.status_code = 500
371+
return resp
372+
373+
350374

351375
@app.route('/getFilesList/<dir>', methods=['POST'])
352376
def getFilesList(dir):

0 commit comments

Comments
 (0)