Created
September 7, 2015 03:25
-
-
Save faisalburhanudin/901c7a3ccebe747756b0 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 import Flask, jsonify | |
| app = Flask(__name__) | |
| @app.route('/api', methods = ['GET']) | |
| def this_func(): | |
| """This is a function. It does nothing.""" | |
| return jsonify({ 'result': '' }) | |
| @app.route('/api/help', methods = ['GET']) | |
| def help(): | |
| """Print available functions.""" | |
| func_list = {} | |
| for rule in app.url_map.iter_rules(): | |
| if rule.endpoint != 'static': | |
| func_list[rule.rule] = app.view_functions[rule.endpoint].__doc__ | |
| return jsonify(func_list) | |
| if __name__ == '__main__': | |
| app.run(debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment