Skip to content

Instantly share code, notes, and snippets.

@faisalburhanudin
Created September 7, 2015 03:25
Show Gist options
  • Select an option

  • Save faisalburhanudin/901c7a3ccebe747756b0 to your computer and use it in GitHub Desktop.

Select an option

Save faisalburhanudin/901c7a3ccebe747756b0 to your computer and use it in GitHub Desktop.
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