示例#1
0
文件: decorators.py 项目: DOAJ/doaj
 def decorated_view(*args, **kwargs):
     api_key = request.values.get("api_key", None)
     if api_key is not None:
         user = Account.pull_by_api_key(api_key)
         if user is not None:
             if login_user(user, remember=False):
                 return fn(*args, **kwargs)
     # else
     raise Api401Error("An API Key is required to access this.")
示例#2
0
 def decorated_view(*args, **kwargs):
     api_key = request.values.get("api_key", None)
     if api_key is not None:
         user = Account.pull_by_api_key(api_key)
         if user is not None:
             if login_user(user, remember=False):
                 return fn(*args, **kwargs)
     # else
     raise Api401Error("An API Key is required to access this.")
示例#3
0
文件: decorators.py 项目: DOAJ/doaj
    def decorated_view(*args, **kwargs):
        api_key = request.values.get("api_key", None)
        if api_key:
            user = Account.pull_by_api_key(api_key)
            if user is not None:
                if login_user(user, remember=False):
                    return fn(*args, **kwargs)
            # else
            abort(401)

        # no api key, which is ok
        return fn(*args, **kwargs)
示例#4
0
    def decorated_view(*args, **kwargs):
        api_key = request.values.get("api_key", None)
        if api_key:
            user = Account.pull_by_api_key(api_key)
            if user is not None:
                if login_user(user, remember=False):
                    return fn(*args, **kwargs)
            # else
            abort(401)

        # no api key, which is ok
        return fn(*args, **kwargs)