diff options
-rw-r--r-- | r_api.py | 18 | ||||
-rw-r--r-- | requirements.txt | 1 |
2 files changed, 13 insertions, 6 deletions
@@ -3,6 +3,7 @@ import subprocess import flask from flask import send_file from flask import Flask, url_for, jsonify, request +from flask_api import status from werkzeug import secure_filename import json import os @@ -18,14 +19,19 @@ if not os.path.exists(TEMP_DIR): app = Flask(__name__) +# @app.route('/') +# def api_root(): +# headers = request.headers +# auth = headers.get("X-Api-Key") +# if auth == AUTH_KEY: +# return jsonify({"message": "OK: Authorized"}), 200 +# else: +# return jsonify({"message": "ERROR: Unauthorized"}), 401 + @app.route('/') def api_root(): - headers = request.headers - auth = headers.get("X-Api-Key") - if auth == AUTH_KEY: - return jsonify({"message": "OK: Authorized"}), 200 - else: - return jsonify({"message": "ERROR: Unauthorized"}), 401 + content = {'status': status.HTTP_200_OK} + return content, status.HTTP_200_OK @app.route('/rscript', methods=['GET', 'POST']) diff --git a/requirements.txt b/requirements.txt index 5c1bea9..cc928eb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ flask flask-session +flask_api |