Azure 笔记本中的 Jupyter 服务器扩展 URL 模式



我正在编写一个Jupyter服务器扩展,将笔记本转换为Web API。它在本地计算机中运行良好。 我在部署到免费的 Azure 笔记本时遇到一些问题。 我无法弄清楚 url 模式或我的服务器扩展未加载。

我已经在 python2.7 的 Azure 笔记本终端中安装了我的软件包,同时内核配置为使用 python 3.xx。 命令:

pip27 install jupyterexcel --user jupyter serverextension enable --py jupyterexcel

我可以看到扩展是通过使用启用的

Jupyter 服务器扩展列表

我的问题是当我启动笔记本时:

https://jupyterexcel-luozhijian.notebooks.azure.com/j/notebooks/TestingJupyter.ipynb

我无法弄清楚如何使服务器扩展 url 模式工作。 在我的本地计算机中,我可以使用:

http://localhost:8888/Excel/TestingJupyter.ipynb?token=ABCD&functionname=sum&1=11&2=8&3=6

server_extension代码在:
https://github.com/luozhijian/jupyterexcel/blob/master/jupyterexcel/server_extension.py

类 ExcelModeHandler(IPythonHandler): 通过 在此处 #some 代码 def load_jupyter_server_extension(nbapp): web_app = nbapp.web_app host_pattern = '.*$' route_pattern = url_path_join(web_app.settings['base_url'], r'/Excel%s' % path_regex) web_app.add_handlers(host_pattern, [(route_pattern, ExcelModeHandler)])

如果我使用如下

https://jupyterexcel-luozhijian.notebooks.azure.com/Excel/j/notebooks/TestingJupyter.ipynb?token=ABCD&functionname=sum&1=11&2=8&3=6 它说页面未找到。  我希望它返回 json:25.0

感谢您分享您的场景!Azure 笔记本不支持 Jupyter 服务器扩展,但我们会将其添加到积压工作中。如果我们可以继续听到对此的要求并能够优先考虑此功能工作,我一定会更新。谢谢!

最新更新