class MethodView(View):
A class-based view that dispatches request methods to the corresponding class methods. For example, if you implement a get method, it will be used to handle GET requests.
class CounterAPI(MethodView): def get(self): return session.get('counter', 0) def post(self): session['counter'] = session.get('counter', 0) + 1 return 'OK' app.add_url_rule('/counter', view_func=CounterAPI.as_view('counter'))
Method | dispatch_request |
Subclasses have to override this method to implement the actual view function code. This method is called with all the arguments from the URL rule. |
Inherited from View
:
Class Method | as_view |
No summary |
Class Variable | decorators |
Undocumented |
Class Variable | methods |
Undocumented |
Class Variable | provide_automatic_options |
Undocumented |
flask.views.View.dispatch_request
Parameters | |
*args:t.Any | Undocumented |
**kwargs:t.Any | Undocumented |
Returns | |
ResponseReturnValue | Undocumented |