Flask CBV
from flask import Flask, views import time app = Flask(__name__) def zhuangshiqi(func): def inner(*args,**kwargs): start_time = time.time() ret = func(*args,**kwargs) print(time.time()-start_time) return ret return inner class Login(views.MethodView): decorators =[zhuangshiqi] def get(self): return "get" def post(self): pass app.add_url_rule("/login",endpoint=None,view_func=Login.as_view(name="login")) if __name__ == '__main__': app.run("0.0.0.0",9527)