Hello John,

When using the Python kernel you can use :

```
from getpass import getpass

password = getpass('prompt='What is your favorite color:')
```

And that should work in the notebook, replacing what you type with *
(always stored in the notebook as six stars, so leak not information).
then `password` will be what you expect it to be[1], see  the python
documentation for getpass[2] as it is not a jupyter specific function.

Hope that helps.

-- 
Matthias
[1]: Likely blue. No,  red.
[2]: https://docs.python.org/3/library/getpass.html

On Mon, Jun 19, 2017 at 4:17 AM, John Omernik <[email protected]> wrote:
> Is there an accepted way to request a runtime password that can be stored in
> a variable in the running kernel for a notebook? The idea here is when a
> user starts using a specific data source, it may require authentication.
> Username is pretty easy, but I want to be able to prompt a user at
> instantiation of a data source object for the password rather than have it
> stored in a password. Now, I could put it in a cell, but the idea is I want
> to be able to write a wrapper module for my org that allows any user running
> the same notebook, to have the exact same code in the notebook execute on
> the datasource with their individual credentials.
>
> So I have notebook A
>
> and I have users X and Y
>
>
> User X creates the notebook, they do something like
>
> myds = instantiatedOrgDS()
>
> it reads the context of the user, and then prompts for the datasource
> password from the user. They enter it in a box that doesn't echo the
> password, it setups up the Data source into the object mysql
>
> next celll:
>
> results = myds.query("select * from the all_the_data")
>
> now the notebook has examples where the results are the same, as are the
> queries. (as long as both users have access to the data source) but either
> user can run the notebook and get the same results.
>
> The kicker is how to prompt for the password securely... any ideas?
>
> Thanks
>
> John
>
> --
> 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/58e97afd-abfd-4b8a-97a8-7776e1262f11%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 [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/CANJQusWsja4BXEmmAGE%2BquusW9MpT-JaH%3DHMbC%3Dr%3DsCmVKS3Zw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to