import os
from IPython.lib import passwd

c.NotebookApp.ip = '*'
c.NotebookApp.port = int(os.getenv('PORT', 8888))
c.NotebookApp.open_browser = False
c.MultiKernelManager.default_kernel_name = 'python2'

# sets a password if PASSWORD is set in the environment
if 'PASSWORD' in os.environ:
  c.NotebookApp.password = passwd(os.environ['PASSWORD'])
  del os.environ['PASSWORD']

import os
from IPython.lib import passwd

c.NotebookApp.ip = '*'
c.NotebookApp.port = int(os.getenv('PORT', 8888))
c.NotebookApp.open_browser = False
c.MultiKernelManager.default_kernel_name = 'python2'

# sets a password if PASSWORD is set in the environment
if 'PASSWORD' in os.environ:
  password = os.environ['PASSWORD']
  if password:
    c.NotebookApp.password = passwd(password)
  else:
    c.NotebookApp.password = ''
    c.NotebookApp.token = ''
  del os.environ['PASSWORD']

Allow disabling password and token auth on jupyter notebooks
Allow disabling password and token auth on jupyter notebooks
  import os
  from IPython.lib import passwd
  
  c.NotebookApp.ip = '*'
  c.NotebookApp.port = int(os.getenv('PORT', 8888))
  c.NotebookApp.open_browser = False
  c.MultiKernelManager.default_kernel_name = 'python2'
  
  # sets a password if PASSWORD is set in the environment
  if 'PASSWORD' in os.environ:
-   c.NotebookApp.password = passwd(os.environ['PASSWORD'])
+   password = os.environ['PASSWORD']
+   if password:
+     c.NotebookApp.password = passwd(password)
+   else:
+     c.NotebookApp.password = ''
+     c.NotebookApp.token = ''
    del os.environ['PASSWORD']
  
Allow disabling password and token auth on jupyter notebooks
## Code Before:
import os
from IPython.lib import passwd

c.NotebookApp.ip = '*'
c.NotebookApp.port = int(os.getenv('PORT', 8888))
c.NotebookApp.open_browser = False
c.MultiKernelManager.default_kernel_name = 'python2'

# sets a password if PASSWORD is set in the environment
if 'PASSWORD' in os.environ:
  c.NotebookApp.password = passwd(os.environ['PASSWORD'])
  del os.environ['PASSWORD']

## Instruction:
Allow disabling password and token auth on jupyter notebooks
## Code After:
import os
from IPython.lib import passwd

c.NotebookApp.ip = '*'
c.NotebookApp.port = int(os.getenv('PORT', 8888))
c.NotebookApp.open_browser = False
c.MultiKernelManager.default_kernel_name = 'python2'

# sets a password if PASSWORD is set in the environment
if 'PASSWORD' in os.environ:
  password = os.environ['PASSWORD']
  if password:
    c.NotebookApp.password = passwd(password)
  else:
    c.NotebookApp.password = ''
    c.NotebookApp.token = ''
  del os.environ['PASSWORD']
