I would like to create a Jupiter notebook extension with a custom request handler. My goal is to have a link, like localhost:8888/NotebookCreatorExtension?data={"cells": [...], ...}, and jupyterhub would create a notebook in the user's root directory with the content written in the data parameter (the data is basically the json of the notebook that I'm trying to load onto the server).

I tried creating a PUT request from the application that was generating the link and contents of the notebook and it would open up in Jupiterhub but the problem was I needed a token in which I used mine, but I want this to work for all users in the server and generating a token is not the way I want to go.

I have the code for generating the link with the contents of a Jupyter notebook. Just need to figure out how to create an request handler extension or if it's even possible to do what I want to do.

1

There are 1 best solutions below

0
On

You will have to implement a custom content manager to modify the way notebooks are created. Refer to https://jupyter-notebook.readthedocs.io/en/stable/extending/contents.html#writing-a-custom-contentsmanager for how to writing a custom content manager.

Instead if you meant adding a new API for a custom behaviour and not modifying existing content APIs, you may refer https://jupyter-notebook.readthedocs.io/en/stable/extending/handlers.html on how to write one.