From c09a23ef289cb1de7129c555f7fd1c4e2839bc84 Mon Sep 17 00:00:00 2001 From: Gareth Coles Date: Thu, 15 Feb 2018 14:31:13 +0000 Subject: Fix up API key validation and database api location --- pysite/decorators.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'pysite/decorators.py') diff --git a/pysite/decorators.py b/pysite/decorators.py index 6951e875..8d0cf7f4 100644 --- a/pysite/decorators.py +++ b/pysite/decorators.py @@ -1,5 +1,6 @@ # coding=utf-8 import os +from functools import wraps from flask import request @@ -13,9 +14,10 @@ def valid_api_key(f): Should only be applied to functions on APIView routes. """ + @wraps(f) def has_valid_api_key(self, *args, **kwargs): if not request.headers.get("X-API-Key") == os.environ.get("API_KEY"): return self.error(ErrorCodes.invalid_api_key) - return f(*args, **kwargs) + return f(self, *args, **kwargs) return has_valid_api_key -- cgit v1.2.3