Since the kernel is a different process from the server, objects in the server are not available to the kernels. Environment variables can be used to share little bits of information throughout the server and kernels, e.g.
export MY_USERNAME='something'
jupyter notebook
in which case the MY_USERNAME env will be available to the server and all of its kernel subprocesses. If the server doesn’t know its name until some time later, you can modify how kernels are started, to pass this environment variable on each kernel launch.
-MinRK
Hi all, I have a user id passed via HttpContext, so in principle the notebook should know who is connecting. I know this is not secure, but should work for "Hey {}".format(context['username'].How can I get access to that HttpContext instance?
--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/45b3039b-41d8-464c-a041-81a108fc8450%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
username = jupyter_client.session.Session().msg_header('')['username']
Since the kernel is a different process from the server, objects in the server are not available to the kernels. Environment variables can be used to share little bits of information throughout the server and kernels, e.g.
export MY_USERNAME='something' jupyter notebook
in which case the MY_USERNAME env will be available to the server and all of its kernel subprocesses. If the server doesn’t know its name until some time later, you can modify how kernels are started, to pass this environment variable on each kernel launch.
-MinRK
On Tue, Aug 9, 2016 at 2:19 PM, Paul A <rootsum...@gmail.com> wrote:
Hi all, I have a user id passed via HttpContext, so in principle the notebook should know who is connecting. I know this is not secure, but should work for "Hey {}".format(context['username'].How can I get access to that HttpContext instance?
--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
Sorry, the question was about retrieving the username of the client connection to the notebook.The server-side username can be easily returned as:
username = jupyter_client.session.Session().msg_header('')['username']
On Tuesday, August 9, 2016 at 2:29:46 PM UTC+1, Min RK wrote:Since the kernel is a different process from the server, objects in the server are not available to the kernels. Environment variables can be used to share little bits of information throughout the server and kernels, e.g.
export MY_USERNAME='something' jupyter notebook
in which case the MY_USERNAME env will be available to the server and all of its kernel subprocesses. If the server doesn’t know its name until some time later, you can modify how kernels are started, to pass this environment variable on each kernel launch.
-MinRK
On Tue, Aug 9, 2016 at 2:19 PM, Paul A <rootsum...@gmail.com> wrote:Hi all, I have a user id passed via HttpContext, so in principle the notebook should know who is connecting. I know this is not secure, but should work for "Hey {}".format(context['username'].--How can I get access to that HttpContext instance?
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/45b3039b-41d8-464c-a041-81a108fc8450%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/fe856710-a5fb-4a4b-9cc7-2dc11778b368%40googlegroups.com.
I don't recall if you can get a user name from JS Web APIs, but if you can, you should be able to pass it to the kernel using a comm
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/CAHNn8BWPzs4oPQ6utOSB54wEbJGGs%2Bz%3DLGkdE6AXF5hF2pwXmA%40mail.gmail.com.