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 <[email protected] <javascript:>
> > 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 [email protected] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jupyter/45b3039b-41d8-464c-a041-81a108fc8450%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/jupyter/45b3039b-41d8-464c-a041-81a108fc8450%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> 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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jupyter/fe856710-a5fb-4a4b-9cc7-2dc11778b368%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.