summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--r_api.py18
-rw-r--r--requirements.txt1
2 files changed, 13 insertions, 6 deletions
diff --git a/r_api.py b/r_api.py
index 9dbd83e..0725e22 100644
--- a/r_api.py
+++ b/r_api.py
@@ -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