From 1987ec05bcfccc7eb30fbfbf5bb084343f7ae22b Mon Sep 17 00:00:00 2001 From: MaelREBOUX Date: Mon, 5 Apr 2021 23:22:05 +0200 Subject: [PATCH] API : test.sh route --- api/api_redadeg.py | 13 +++++++++++++ api/test.sh | 2 ++ 2 files changed, 15 insertions(+) create mode 100755 api/test.sh diff --git a/api/api_redadeg.py b/api/api_redadeg.py index ca187ef..578786a 100644 --- a/api/api_redadeg.py +++ b/api/api_redadeg.py @@ -3,6 +3,12 @@ from flask import Flask +import subprocess +from subprocess import Popen, PIPE +from subprocess import check_output + + + app = Flask(__name__) @@ -12,6 +18,13 @@ def index(): return "

Ar Redadeg API

" pass + +@app.route("/test/") +def test(): + stdout = check_output(['./test.sh']).decode('utf-8') + return stdout + + @app.route("/about/") def about(): return "This is a simple Flask Python application" diff --git a/api/test.sh b/api/test.sh new file mode 100755 index 0000000..c3ed9d9 --- /dev/null +++ b/api/test.sh @@ -0,0 +1,2 @@ +#!/bin/bash +echo "hello from shell script"