mirror of
https://github.com/jupyter/notebook.git
synced 2025-02-05 12:19:58 +08:00
Merge pull request #6654 from Carreau/closes-6647
Have /api return the IPython version
This commit is contained in:
commit
00f88ee1be
@ -24,6 +24,8 @@ try:
|
||||
except ImportError:
|
||||
app_log = logging.getLogger()
|
||||
|
||||
import IPython
|
||||
|
||||
from IPython.config import Application
|
||||
from IPython.utils.path import filefind
|
||||
from IPython.utils.py3compat import string_types
|
||||
@ -398,6 +400,13 @@ class FileFindHandler(web.StaticFileHandler):
|
||||
return super(FileFindHandler, self).validate_absolute_path(root, absolute_path)
|
||||
|
||||
|
||||
class ApiVersionHandler(IPythonHandler):
|
||||
|
||||
@json_errors
|
||||
def get(self):
|
||||
# not authenticated, so give as few info as possible
|
||||
self.finish(json.dumps({"version":IPython.__version__}))
|
||||
|
||||
class TrailingSlashHandler(web.RequestHandler):
|
||||
"""Simple redirect handler that strips trailing slashes
|
||||
|
||||
@ -456,5 +465,6 @@ file_path_regex = "%s/%s" % (path_regex, file_name_regex)
|
||||
|
||||
|
||||
default_handlers = [
|
||||
(r".*/", TrailingSlashHandler)
|
||||
(r".*/", TrailingSlashHandler),
|
||||
(r"api", ApiVersionHandler)
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user