diff options
Diffstat (limited to 'gn3/api/ctl.py')
-rw-r--r-- | gn3/api/ctl.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gn3/api/ctl.py b/gn3/api/ctl.py new file mode 100644 index 0000000..ac33d63 --- /dev/null +++ b/gn3/api/ctl.py @@ -0,0 +1,24 @@ +"""module contains endpoints for ctl""" + +from flask import Blueprint +from flask import request +from flask import jsonify + +from gn3.computations.ctl import call_ctl_script + +ctl = Blueprint("ctl", __name__) + + +@ctl.route("/run_ctl", methods=["POST"]) +def run_ctl(): + """endpoint to run ctl + input: request form object + output:json object enum::(response,error) + + """ + ctl_data = request.json + + (cmd_results, response) = call_ctl_script(ctl_data) + return (jsonify({ + "results": response + }), 200) if response is not None else (jsonify({"error": str(cmd_results)}), 401) |