Back to module index

Go to module by name

getpass

Utilities to get a password and/or the current user name.

getpass(prompt[, stream]) - Prompt for a password, with echo turned off.
getuser() - Get the user name from the environment or password database.

GetPassWarning - This UserWarning is issued when getpass() cannot prevent
                 echoing of the password contents while reading.

On Windows, the msvcrt module will be used.


Classes

GetPassWarning

with_traceback(...)

  Exception.with_traceback(tb) --
      set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>

Functions

fallback_getpass

fallback_getpass(prompt='Password: ', stream=None)

getpass

unix_getpass(prompt='Password: ', stream=None)

  Prompt for a password, with echo turned off.

      Args:
        prompt: Written on stream to ask for the input.  Default: 'Password: '
        stream: A writable file object to display the prompt.  Defaults to
                the tty.  If no tty is available defaults to sys.stderr.
      Returns:
        The seKr3t input.
      Raises:
        EOFError: If our input tty or stdin was closed.
        GetPassWarning: When we were unable to turn echo off on the input.

      Always restores terminal settings before returning.
    

getuser

getuser()

  Get the username from the environment or password database.

      First try various environment variables, then the password
      database.  This works on Windows as long as USERNAME is set.

    

unix_getpass

unix_getpass(prompt='Password: ', stream=None)

  Prompt for a password, with echo turned off.

      Args:
        prompt: Written on stream to ask for the input.  Default: 'Password: '
        stream: A writable file object to display the prompt.  Defaults to
                the tty.  If no tty is available defaults to sys.stderr.
      Returns:
        The seKr3t input.
      Raises:
        EOFError: If our input tty or stdin was closed.
        GetPassWarning: When we were unable to turn echo off on the input.

      Always restores terminal settings before returning.
    

win_getpass

win_getpass(prompt='Password: ', stream=None)

  Prompt for password with echo off, using Windows getwch().

Modules

contextlib

io

os

sys

termios

warnings