diff options
author | 2018-02-15 14:31:13 +0000 | |
---|---|---|
committer | 2018-02-15 14:31:13 +0000 | |
commit | c09a23ef289cb1de7129c555f7fd1c4e2839bc84 (patch) | |
tree | 009d6c3995e12855b78daa0d83d9402c1a159206 /pysite/decorators.py | |
parent | Move API validation decorator to its own file #yxdk (diff) |
Fix up API key validation and database api location
Diffstat (limited to 'pysite/decorators.py')
-rw-r--r-- | pysite/decorators.py | 4 |
1 files changed, 3 insertions, 1 deletions
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 |