##// END OF EJS Templates
restrict login redirect to notebook app...
restrict login redirect to notebook app prevents redirect to other websites from login page

File last commit:

r21469:b15ba97b
r21489:e37c71b3
Show More
handlers.py
25 lines | 696 B | text/x-python | PythonLexer
Thomas Kluyver
Separate listing nbconvert exporters to /api/nbconvert
r13837 import json
from tornado import web
Min RK
Add APIHandler base class...
r21469 from ...base.handlers import APIHandler, json_errors
Thomas Kluyver
Separate listing nbconvert exporters to /api/nbconvert
r13837
Min RK
Add APIHandler base class...
r21469 class NbconvertRootHandler(APIHandler):
Thomas Kluyver
Separate listing nbconvert exporters to /api/nbconvert
r13837 SUPPORTED_METHODS = ('GET',)
@web.authenticated
@json_errors
def get(self):
MinRK
turn missing dependencies in nbconvert to 500 errors...
r14044 try:
from IPython.nbconvert.exporters.export import exporter_map
except ImportError as e:
raise web.HTTPError(500, "Could not import nbconvert: %s" % e)
Thomas Kluyver
Separate listing nbconvert exporters to /api/nbconvert
r13837 res = {}
for format, exporter in exporter_map.items():
res[format] = info = {}
info['output_mimetype'] = exporter.output_mimetype
self.finish(json.dumps(res))
default_handlers = [
(r"/api/nbconvert", NbconvertRootHandler),
]