2014年5月12日 星期一

Flask get all routing rules

for rule in app.url_map.iter_rules():
    options = {}
    for arg in rule.arguments:
        options[arg] = "[{0}]".format(arg)

    methods = ','.join(rule.methods)
    url = url_for(rule.endpoint, **options) 
 
    print rule.endpoint
    print methods
    print url
 
 
 
 
References :
python - get a list of all routes defined in the app - Stack Overflow

沒有留言:

張貼留言