[IPython-dev] is it possible to pass parameters to IPython notebook via URL?

MinRK benjaminrk at gmail.com
Fri May 9 16:43:07 EDT 2014


On Fri, May 9, 2014 at 1:25 PM, Roman Max. <rmx555 at hotmail.com> wrote:

OK, thanks for clarifying it once again. Javascript API means user needs to
> interact with the page once it's already loaded?
>
 Yes. Or you can add custom javascript to the page to take action based on
the parameters once the page is loaded. But again, I wouldn’t recommend
doing this, because it may conflict with server changes in the future. If
you go this route, I would suggest using # instead of ?, since it would
really be client-side only information.


> do you plan for such an enhancement (passing parameters via URL to
> notebooks)?
>
No. The HTML/Javascript context of the page and notebook server are
strongly decoupled from the Python environment of the Kernel. We have no
plan to change this.

or which class would I need to modify to implement support for this?
>
At least a few:

   - the NotebookHandler, which renders the notebook page, which will
   receive the URL with parameters, but is not the URL that starts the kernel.
   - the KernelManager, which starts the kernel, which would need to be
   told about these parameters
   - possibly the Kernel itself, for taking the actual actions you wish
   these parameters to imply in the kernel process.

Depending on how much javascript you customize, there are probably a few
combinations of classes to modify.

Can we back up a bit, and ask what you want to accomplish by passing these
parameters? There may be a simpler solution than subclassing the entire
notebook server.

-MinRK

------------------------------
> From: benjaminrk at gmail.com
> Date: Thu, 8 May 2014 16:03:15 -0700
>
> To: ipython-dev at scipy.org
> Subject: Re: [IPython-dev] is it possible to pass parameters to IPython
> notebook via URL?
>
>
>
>
> On Thu, May 8, 2014 at 11:51 AM, Roman Max. <rmx555 at hotmail.com> wrote:
>
> Many thanks for the reply, I see. Indeed I am looking for a way to pass
> parameters to the Python code on the kernel, e.g. .NET app calling out a
> notebook with parameters and displaying output.
> So, essentially the notebook server doesn't support this sort of
> interaction at the moment? I assume I could do it by cloning and modifying
> .ipynb template file before each request, still hoping there is a better
> way than that.
>
>
> No, the server definitely doesn't support URLs affecting the kernel. If
> you want to execute code on the Kernel, you would do this via the
> Javascript APIs.
>
> -MinRK
>
>
>
>
> ------------------------------
> From: benjaminrk at gmail.com
> Date: Thu, 8 May 2014 10:47:16 -0700
> To: ipython-dev at scipy.org
> Subject: Re: [IPython-dev] is it possible to pass parameters to IPython
> notebook via URL?
>
>
> You can do this, but I wouldn't recommend it. The parameters will only be
> available to the HTML/JS in the notebook page, and not the Python code on
> the kernel.  Plus, there is a chance that it would conflict with any future
> use of url parameters by the notebook server.
>
> -MinRK
>
>
> On Thu, May 8, 2014 at 10:11 AM, Roman Max. <rmx555 at hotmail.com> wrote:
>
>  is it possible to pass parameters to IPython notebook via URL?
>
> How to reference/use those parameters in a notebook?
>
> e.g. http://xxxyyzz.org:8888/mynotebook.ipynb*?d1=20140101&d2=20140401*
>
>
>  Did not find an answer after searching around. Thanks!
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
>
> _______________________________________________ IPython-dev mailing list
> IPython-dev at scipy.org http://mail.scipy.org/mailman/listinfo/ipython-dev
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
>
> _______________________________________________ IPython-dev mailing list
> IPython-dev at scipy.org http://mail.scipy.org/mailman/listinfo/ipython-dev
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140509/ff1d6622/attachment.html>


More information about the IPython-dev mailing list