Apply Flask MethodView decorator just for some methods
问题 I was wondering if there is any way that I can use a decorator just for some methods from my class, for example in the following code I want token_required to decorate all methods excepting the POST, how could I possibly achieve that? class UserAPI(MethodView): def token_required(view_method): @wraps(view_method) def decorated(*args, **kwargs): token = None if 'token' in request.headers: token = request.headers['token'] if not token: return "no token" return view_method(*args, **kwargs)