<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><span style="font-family: Helvetica; font-size: 12px;">Many thanks for following up on this thread. I would like to use IPython notebook to perform and present some analytics in a .NET application. I've got a CefSharp (chrome) component integrated and can display notebook's output. Now trying to figure out how to pass parameters, so notebook calculates some analytics per selected object. E.g. depending on a selected object .NET prepares a CSV data input file, then the path of this file would need to be passed to an IPython notebook for further processing. </span><br style="font-family: Helvetica; font-size: 12px;"><br style="font-family: Helvetica; font-size: 12px;"><span style="font-family: Helvetica; font-size: 12px;">After looking at your Singlecell.py code I think I start to understand where you are heading with giving hints with respect to JavaScript. Essentially .NET app could prepare HTML/Javascrpit part each time a new object is selected and pass it then over to IPython kernel for execution? Porbably will work, just doesn't look so clean, since python logic code will be in javascript files.</span><div><font face="Helvetica"><span style="font-size: 12px;"><br></span></font></div><div><font face="Helvetica"><span style="font-size: 12px;">would be still nice to have a way to communicate with the IPython only via URL, as not always client side presentation part(Javascript) can be involved.</span></font></div><div><font face="Helvetica"><span style="font-size: 12px;"><br></span></font></div><div><font face="Helvetica"><span style="font-size: 12px;">RM<br></span></font><div><br><div><hr id="stopSpelling">From: benjaminrk@gmail.com<br>Date: Fri, 9 May 2014 13:43:07 -0700<br>To: ipython-dev@scipy.org<br>Subject: Re: [IPython-dev] is it possible to pass parameters to IPython notebook via URL?<br><br><div dir="ltr"><div class="ecxmarkdown-here-wrapper" id="ecxmarkdown-here-wrapper-839046"><p style="">On Fri, May 9, 2014 at 1:25 PM, Roman Max. <<a href="mailto:rmx555@hotmail.com" target="_blank">rmx555@hotmail.com</a>> wrote:</p>


<p style=""></p><div class="ecxmarkdown-here-exclude"><BR><blockquote class="ecxgmail_quote" style="border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex;">




<div><div dir="ltr">OK, thanks for clarifying it once again. Javascript API means user needs to interact with the page once it's already loaded?</div></div></blockquote><BR></div><p style="">

</p>
<p style="">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 <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;padding:0px 0.3em;white-space:nowrap;border:1px solid rgb(234,234,234);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;display:inline;background-color:rgb(248,248,248);">#</code> instead of <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;padding:0px 0.3em;white-space:nowrap;border:1px solid rgb(234,234,234);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;display:inline;background-color:rgb(248,248,248);">?</code>, since it would really be client-side only information.</p>


<p style=""></p><div class="ecxmarkdown-here-exclude"><BR><blockquote class="ecxgmail_quote" style="border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex;">

<div><div dir="ltr"><div><br></div><div>do you plan for such an enhancement (passing parameters via URL to notebooks)? <br></div></div></div></blockquote><BR></div><p style=""></p>
<p style="">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.</p>
<p style=""></p><div class="ecxmarkdown-here-exclude"><BR><blockquote class="ecxgmail_quote" style="border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex;">

<div><div dir="ltr"><div>or which class would I need to modify to implement support for this?<br></div></div></div></blockquote><BR></div><p style=""></p>
<p style="">At least a few:</p>
<ul style="padding-left:2em;">
<li style="">the NotebookHandler, which renders the notebook page, which will receive the URL with parameters, but is not the URL that starts the kernel.</li>
<li style="">the KernelManager, which starts the kernel, which would need to be told about these parameters</li>
<li style="">possibly the Kernel itself, for taking the actual actions you wish these parameters to imply in the kernel process.</li>
</ul>
<p style="">Depending on how much javascript you customize, there are probably a few combinations of classes to modify.</p>
<p style="">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.</p>
<p style="">-MinRK</p>
<p style=""></p><div class="ecxmarkdown-here-exclude"><BR><blockquote class="ecxgmail_quote" style="border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex;">

<div><div dir="ltr"><div><div><hr>From: <a href="mailto:benjaminrk@gmail.com" target="_blank">benjaminrk@gmail.com</a><br>Date: Thu, 8 May 2014 16:03:15 -0700<div><div class="h5"><br>To: <a href="mailto:ipython-dev@scipy.org" target="_blank">ipython-dev@scipy.org</a><br>

Subject: Re: [IPython-dev] is it possible to pass parameters to IPython notebook via URL?<br><br><div dir="ltr"><br><div><br><br><div>On Thu, May 8, 2014 at 11:51 AM, Roman Max. <span dir="ltr"><<a href="mailto:rmx555@hotmail.com" target="_blank">rmx555@hotmail.com</a>></span> wrote:<br>



<blockquote style="border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex;">


<div><div dir="ltr">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.<div>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.<br>



</div></div></div></blockquote><div><br></div><div>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.</div><div>


<br>
</div><div>-MinRK</div><div><br></div><div> </div><blockquote style="border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex;"><div><div dir="ltr"><div><br><div><hr>From: <a href="mailto:benjaminrk@gmail.com" target="_blank">benjaminrk@gmail.com</a><br>



Date: Thu, 8 May 2014 10:47:16 -0700<br>To: <a href="mailto:ipython-dev@scipy.org" target="_blank">ipython-dev@scipy.org</a><br>Subject: Re: [IPython-dev] is it possible to pass parameters to IPython notebook via URL?<div>



<div><br><br><div dir="ltr">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.<div>





<br></div><div>-MinRK</div></div><div><br><br><div>On Thu, May 8, 2014 at 10:11 AM, Roman Max. <span dir="ltr"><<a href="mailto:rmx555@hotmail.com" target="_blank">rmx555@hotmail.com</a>></span> wrote:<br>

<blockquote style="border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex;">


<div><div dir="ltr"><p style="border:0px;font-size:14px;vertical-align:baseline;clear:both;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:18px;background-color:rgb(255,255,255);">





is it possible to pass parameters to IPython notebook via URL?</p><p style="border:0px;font-size:14px;vertical-align:baseline;clear:both;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:18px;background-color:rgb(255,255,255);">





How to reference/use those parameters in a notebook?</p><p style="border:0px;font-size:14px;vertical-align:baseline;clear:both;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:18px;background-color:rgb(255,255,255);">





e.g. <a href="http://xxxyyzz.org:8888/mynotebook.ipynb" rel="nofollow" style="padding:0px;border:0px;vertical-align:baseline;color:rgb(74,107,130);text-decoration:none;background-color:transparent;" target="_blank">http://xxxyyzz.org:8888/mynotebook.ipynb</a><strong style="padding:0px;border:0px;vertical-align:baseline;background-color:transparent;">?d1=20140101&d2=20140401</strong></p>





<p style="border:0px;font-size:14px;vertical-align:baseline;clear:both;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:18px;background-color:rgb(255,255,255);"><br>

</p><p style="border:0px;font-size:14px;vertical-align:baseline;clear:both;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:18px;background-color:rgb(255,255,255);">

Did not find an answer after searching around. Thanks!</p>                                          </div></div>
<br>_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org" target="_blank">IPython-dev@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________
IPython-dev mailing list
<a href="mailto:IPython-dev@scipy.org" target="_blank">IPython-dev@scipy.org</a>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a></div></div></div></div>                                       </div></div>
<br>_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org" target="_blank">IPython-dev@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
<br></blockquote></div><br></div></div>
<br>_______________________________________________
IPython-dev mailing list
<a href="mailto:IPython-dev@scipy.org" target="_blank">IPython-dev@scipy.org</a>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a></div></div></div></div>                                       </div></div>
<br>_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
<br></blockquote><BR></div><p style=""></p>
</div></div>
<br>_______________________________________________
IPython-dev mailing list
IPython-dev@scipy.org
http://mail.scipy.org/mailman/listinfo/ipython-dev</div></div></div>                                    </div></body>
</html>