ar_redadeg/api/api_redadeg.py

43 lines
716 B
Python
Raw Normal View History

#!usr/local/bin/python
# -*- coding: utf-8 -*-
from flask import Flask
2021-04-05 21:22:05 +00:00
import subprocess
from subprocess import Popen, PIPE
from subprocess import check_output
app = Flask(__name__)
@app.route("/")
2021-04-05 21:09:54 +00:00
def index():
return "<h1 style='color:blue'>Ar Redadeg API</h1>"
pass
2021-04-05 21:22:05 +00:00
@app.route("/test/")
def test():
stdout = check_output(['./test.sh']).decode('utf-8')
return stdout
2021-04-06 19:32:05 +00:00
@app.route("/phase1/")
2021-04-06 19:41:45 +00:00
def phase1():
2021-04-06 20:25:07 +00:00
stdout = check_output(['/data/projets/ar_redadeg/scripts/traitements_phase_1.sh 2022']).decode('utf-8')
2021-04-06 19:32:05 +00:00
return stdout
2021-04-05 15:05:40 +00:00
@app.route("/about/")
def about():
2021-04-05 21:09:54 +00:00
return "This is a simple Flask Python application"
2021-04-05 15:05:40 +00:00
if __name__ == "__main__":
app.debug = True
app.run(host='0.0.0.0')