Jupyter: Difference between revisions
From charlesreid1
No edit summary |
|||
| Line 40: | Line 40: | ||
</pre> | </pre> | ||
Or from a Python script: | |||
<pre> | |||
from notebook.auth import passwd | |||
passwd('the_worst_password_in_the_world') | |||
</pre> | |||
[[Category:Jupyter]] | [[Category:Jupyter]] | ||
[[Category:Python]] | [[Category:Python]] | ||
Revision as of 06:11, 19 April 2017
Jupyter Notebooks
(Also see: Ipython)
Jupyter Notebooks provide access to the Python programming language through a web browser interface.
Setting up password-protected Jupyter notebook
If you just want a single-user password-protected Jupyter notebook, you can modify Jupyter's config file, jupyter_notebook_config.py, to contain a hashed password. Then, when you run it, Jupyter will load the configuration file and password-protect the notebook that it starts up. Here's how to do that:
Create config file
Start by running a Jupyter command that will create a new, empty config file:
$ jupyter notebook --generate-config
The file it creates is called jupyter_notebook_config.json. Once you generate the hashed password, this is where you'll add it.
Generate hashed password
You can generate a hashed password by interactively entering your password on the command line, live:
$ jupyter notebook password Enter password: ******* Verify password: ******* [NotebookPasswordApp] Wrote hashed password to /Users/you/.jupyter/jupyter_notebook_config.json
Alternatively, you can generate the hash yourself, or in a script, using components of Juypter notebook from a Python script:
>>> from notebook.auth import passwd >>> passwd() Enter password: Verify password: 'sha1:8c8fe60bb8b6:ccf9ede0825894254b2e042ea597d77107ee11abd'
Or from a Python script:
from notebook.auth import passwd
passwd('the_worst_password_in_the_world')