diff options
Diffstat (limited to 'pysite/decorators.py')
-rw-r--r-- | pysite/decorators.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/pysite/decorators.py b/pysite/decorators.py index 0c31fe6e..befc0869 100644 --- a/pysite/decorators.py +++ b/pysite/decorators.py @@ -1,4 +1,3 @@ -import os from functools import wraps from json import JSONDecodeError @@ -7,7 +6,7 @@ from schema import Schema, SchemaError from werkzeug.exceptions import Forbidden from pysite.base_route import APIView, BaseView -from pysite.constants import CSRF, DEBUG_MODE, ErrorCodes, ValidationTypes +from pysite.constants import CSRF, DEBUG_MODE, ErrorCodes, ValidationTypes, BOT_API_KEY def csrf(f): @@ -58,7 +57,7 @@ def api_key(f): @wraps(f) def inner_decorator(self: APIView, *args, **kwargs): - if not request.headers.get("X-API-Key") == os.environ.get("BOT_API_KEY"): + if not request.headers.get("X-API-Key") == BOT_API_KEY: return self.error(ErrorCodes.invalid_api_key) return f(self, *args, **kwargs) |