Python GetPass
getpass is a utility module for getting user input without printing to the screen.
Contents
Usage
GetPass
Get user input without printing to the screen.
import getpass passwd = getpass.getpass(prompt='This is a prompt for your password: ')
The prompt anmed option defaults to "Password: ".
Internally the prompt is written to a file stream (/dev/tty by default, or sys.stderr if that is unavailable). This can be configured with the stream named option except on Windows.
If a non-printing stream cannot be located, getpass.getpass falls back on sys.stdin and raises getpass.GetPassWarning.
GetPassWarning
A UserWarning subclass that is raised when user input may be printed to the screen.
GetUser
Returns the value of the first non-empty environment variable: LOGNAME, USER, LNAME, and USERNAME, in that order.
See also
Python getpass module documentation
Python Module of the Day article for getpass