Ajout de l'API backend
This commit is contained in:
parent
7ac5dcdfe9
commit
0a25528b97
34
api-backend/api.py
Executable file
34
api-backend/api.py
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/python2.7
|
||||
# coding: utf-8
|
||||
# Author : Alexandre Jauneau
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
import requests
|
||||
from flask import Flask, jsonify, request
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
"""
|
||||
Fait un call à l'API backend et renvoit le resultat au format JSON
|
||||
"""
|
||||
response = {}
|
||||
response['body'] = "Je suis une réponse du backend"
|
||||
return jsonify(response)
|
||||
|
||||
|
||||
@app.route('/traceback')
|
||||
def traceback():
|
||||
"""
|
||||
Termine l'application avec un code erreur 1
|
||||
"""
|
||||
os._exit(1)
|
||||
return
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True, host='0.0.0.0', port=8001)
|
Loading…
Reference in New Issue
Block a user