19 lines
448 B
Python
19 lines
448 B
Python
from functools import wraps
|
|
from flask import current_app, request, abort
|
|
|
|
|
|
def verify_token(f):
|
|
"""Verifies request token"""
|
|
|
|
@wraps(f)
|
|
def wrapped(*args, **kwargs):
|
|
rec = request.args.get('record', None)
|
|
token = request.args.get('token', None)
|
|
|
|
if rec in current_app.config['TOKENS'] and current_app.config['TOKENS'][rec] == token:
|
|
return f(*args, **kwargs)
|
|
|
|
abort(403)
|
|
|
|
return wrapped
|