aboutsummaryrefslogtreecommitdiffstats
path: root/pysite/base_route.py
diff options
context:
space:
mode:
Diffstat (limited to 'pysite/base_route.py')
-rw-r--r--pysite/base_route.py17
1 files changed, 1 insertions, 16 deletions
diff --git a/pysite/base_route.py b/pysite/base_route.py
index 730b3e10..e1b9c6b2 100644
--- a/pysite/base_route.py
+++ b/pysite/base_route.py
@@ -2,9 +2,8 @@
import os
import random
import string
-from functools import wraps
-from flask import Blueprint, g, jsonify, render_template, request
+from flask import Blueprint, g, jsonify, render_template
from flask.views import MethodView
from rethinkdb.ast import Table
@@ -93,20 +92,6 @@ class APIView(RouteView):
pool = random.choices(string.ascii_letters + string.digits, k=32)
return "".join(pool)
- def valid_api_key(f):
- """
- Decorator to check if X-API-Key is valid.
- """
- @wraps(f)
- def has_valid_api_key(*args, **kwargs):
- if not request.headers.get("X-API-Key") == os.environ.get("API_KEY"):
- resp = jsonify({"error_code": 401, "error_message": "Invalid API-Key"})
- resp.status_code = 401
- return resp
- return f(*args, **kwargs)
-
- return has_valid_api_key
-
def error(self, error_code: ErrorCodes):
data = {