Created
July 27, 2017 22:40
-
-
Save categulario/165c4dbcdc5b24084afff2c56453ad27 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def login_required(view): | |
@wraps(view) | |
def decorated(*args, **kwargs): | |
auth = request.authorization | |
if auth is None: | |
abort(401) | |
user = User.get_by('api_key', auth.password) | |
if user is not None: | |
g.user = user | |
return view(*args, **kwargs) | |
return decorated |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment