You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
804 B
Python
25 lines
804 B
Python
import json
|
|
|
|
from jupyter_server.base.handlers import APIHandler
|
|
from jupyter_server.utils import url_path_join
|
|
import tornado
|
|
|
|
class RouteHandler(APIHandler):
|
|
# The following decorator should be present on all verb methods (head, get, post,
|
|
# patch, put, delete, options) to ensure only authorized user can request the
|
|
# Jupyter server
|
|
@tornado.web.authenticated
|
|
def get(self):
|
|
self.finish(json.dumps({
|
|
"data": "This is /jupyterlite-echo-kernel/get_example endpoint!"
|
|
}))
|
|
|
|
|
|
def setup_handlers(web_app):
|
|
host_pattern = ".*$"
|
|
|
|
base_url = web_app.settings["base_url"]
|
|
route_pattern = url_path_join(base_url, "jupyterlite-echo-kernel", "get_example")
|
|
handlers = [(route_pattern, RouteHandler)]
|
|
web_app.add_handlers(host_pattern, handlers)
|