api autodoc path
This commit is contained in:
26
helpers/apiDocumentationHelper.py
Normal file
26
helpers/apiDocumentationHelper.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import json
|
||||
|
||||
import tornado.gen
|
||||
import tornado.web
|
||||
|
||||
from web import asyncTornado
|
||||
|
||||
from objects import glob
|
||||
|
||||
class handler(asyncTornado.asyncRequestHandler):
|
||||
@tornado.web.asynchronous
|
||||
@tornado.gen.engine
|
||||
def asyncGet(self):
|
||||
url = "/".join( [x for x in self.request.uri.split("/")][:-1] )
|
||||
ver = self.request.uri.split("/")[-1]
|
||||
|
||||
data = {
|
||||
"browse": ver,
|
||||
"apis": [
|
||||
x[0] for x in glob.routes if x[0].startswith("%s/%s/" % (url, ver))
|
||||
]
|
||||
}
|
||||
|
||||
self.write( json.dumps(data) )
|
||||
self.set_header("Content-Type", "application/json")
|
||||
self.set_status(200)
|
||||
Reference in New Issue
Block a user