Last active
August 29, 2015 14:27
-
-
Save ties/2f9709d1abb011318701 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask.views import MethodView | |
| from flask import jsonify | |
| class JSONMethodView(MethodView): | |
| """ | |
| A view that returns json objects | |
| The view calls self.dispatch_[method] and | |
| returns the result using jsonify | |
| """ | |
| def dispatch_request(self, *args, **kwargs): | |
| res = super(JSONMethodView, self).dispatch_request(*args, **kwargs) | |
| return jsonify(res) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Map the routes | |
| """ | |
| blueprint.add_url_rule("/aggregate/<group>", | |
| view_func=JobfeedAggregation.as_view('data_endpoint')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment