You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
605 B

14 years ago
from couchpotato.core.helpers.request import jsonified
14 years ago
from flask.blueprints import Blueprint
14 years ago
api = Blueprint('api', __name__)
def addApiView(route, func, static = False):
13 years ago
api.add_url_rule(route + ('' if static else '/'), endpoint = route.replace('.', '-') if route else 'index', view_func = func)
14 years ago
""" Api view """
def index():
14 years ago
from couchpotato import app
routes = []
for route, x in sorted(app.view_functions.iteritems()):
if route[0:4] == 'api.':
routes += [route[4:]]
14 years ago
return jsonified({'routes': routes})
14 years ago
addApiView('', index)
addApiView('default', index)