2007-08-15 14:28:22 +00:00
|
|
|
:mod:`getpass` --- Portable password input
|
|
|
|
==========================================
|
|
|
|
|
|
|
|
.. module:: getpass
|
|
|
|
:synopsis: Portable reading of passwords and retrieval of the userid.
|
|
|
|
.. moduleauthor:: Piers Lauder <piers@cs.su.oz.au>
|
|
|
|
.. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
|
Merged revisions 59605-59624 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59606 | georg.brandl | 2007-12-29 11:57:00 +0100 (Sat, 29 Dec 2007) | 2 lines
Some cleanup in the docs.
........
r59611 | martin.v.loewis | 2007-12-29 19:49:21 +0100 (Sat, 29 Dec 2007) | 2 lines
Bug #1699: Define _BSD_SOURCE only on OpenBSD.
........
r59612 | raymond.hettinger | 2007-12-29 23:09:34 +0100 (Sat, 29 Dec 2007) | 1 line
Simpler documentation for itertools.tee(). Should be backported.
........
r59613 | raymond.hettinger | 2007-12-29 23:16:24 +0100 (Sat, 29 Dec 2007) | 1 line
Improve docs for itertools.groupby(). The use of xrange(0) to create a unique object is less obvious than object().
........
r59620 | christian.heimes | 2007-12-31 15:47:07 +0100 (Mon, 31 Dec 2007) | 3 lines
Added wininst-9.0.exe executable for VS 2008
Integrated bdist_wininst into PCBuild9 directory
........
r59621 | christian.heimes | 2007-12-31 15:51:18 +0100 (Mon, 31 Dec 2007) | 1 line
Moved PCbuild directory to PC/VS7.1
........
r59622 | christian.heimes | 2007-12-31 15:59:26 +0100 (Mon, 31 Dec 2007) | 1 line
Fix paths for build bot
........
r59623 | christian.heimes | 2007-12-31 16:02:41 +0100 (Mon, 31 Dec 2007) | 1 line
Fix paths for build bot, part 2
........
r59624 | christian.heimes | 2007-12-31 16:18:55 +0100 (Mon, 31 Dec 2007) | 1 line
Renamed PCBuild9 directory to PCBuild
........
2007-12-31 16:14:33 +00:00
|
|
|
.. Windows (& Mac?) support by Guido van Rossum.
|
2007-08-15 14:28:22 +00:00
|
|
|
|
|
|
|
The :mod:`getpass` module provides two functions:
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: getpass([prompt[, stream]])
|
|
|
|
|
|
|
|
Prompt the user for a password without echoing. The user is prompted using the
|
|
|
|
string *prompt*, which defaults to ``'Password: '``. On Unix, the prompt is
|
|
|
|
written to the file-like object *stream*, which defaults to ``sys.stdout`` (this
|
|
|
|
argument is ignored on Windows).
|
|
|
|
|
|
|
|
Availability: Macintosh, Unix, Windows.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: getuser()
|
|
|
|
|
|
|
|
Return the "login name" of the user. Availability: Unix, Windows.
|
|
|
|
|
|
|
|
This function checks the environment variables :envvar:`LOGNAME`,
|
|
|
|
:envvar:`USER`, :envvar:`LNAME` and :envvar:`USERNAME`, in order, and returns
|
|
|
|
the value of the first one which is set to a non-empty string. If none are set,
|
|
|
|
the login name from the password database is returned on systems which support
|
|
|
|
the :mod:`pwd` module, otherwise, an exception is raised.
|
|
|
|
|