Is it possible to write an Jupyter notebook such that parameters can be passed in via the URL of the notebook?
Example, for a URL such as this:
http://jupyter.example.com/user/me/notebooks/notebook1.ipynb?Variable1=Value1&Variable2=Value2
how could access Variable1
and Variable2
inside the Jupyter cell?
You need to find out the URL using JavaScript and pass it to the IPython kernel:
or:
Then in the next cell:
After this you can use the tools in the standard library (or plain string operations) to pull out the query parameters.
You just need to take the values with javascript and push them to the ipython kernel like in the John Schmitt's link.
Cell [1]:
And in another cell you can retrieve the python variables named Var1 and Var2:
And: