diff options
author | prashantsinalkar | 2019-12-19 11:28:51 +0530 |
---|---|---|
committer | prashantsinalkar | 2019-12-19 11:28:51 +0530 |
commit | dbc9ec1953fb965691550c5989992881b7658f04 (patch) | |
tree | 74c654d579013a338e897e6939f43df6f0b39b5c | |
parent | 2eac156049b51312c20d24ccd0e57b0fe62c0ecd (diff) | |
download | R_on_Cloud_Flask_Web_API-dbc9ec1953fb965691550c5989992881b7658f04.tar.gz R_on_Cloud_Flask_Web_API-dbc9ec1953fb965691550c5989992881b7658f04.tar.bz2 R_on_Cloud_Flask_Web_API-dbc9ec1953fb965691550c5989992881b7658f04.zip |
-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 |