Did I find the right examples for you? yes no Crawl my project Python Jobs
All Samples(5) | Call(5) | Derive(0) | Import(0)
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.(more...)
def 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. """ fd = None tty = None try: # Always try reading and writing directly on the tty first. fd = os.open('/dev/tty', os.O_RDWR|os.O_NOCTTY) tty = os.fdopen(fd, 'w+', 1) input = tty if not stream: stream = tty except EnvironmentError, e: # If that fails, see if stdin can be controlled. try: fd = sys.stdin.fileno() except (AttributeError, ValueError): passwd = fallback_getpass(prompt, stream) input = sys.stdin if not stream: stream = sys.stderr if fd is not None: passwd = None try: old = termios.tcgetattr(fd) # a copy to save new = old[:] new[3] &= ~termios.ECHO # 3 == 'lflags' tcsetattr_flags = termios.TCSAFLUSH if hasattr(termios, 'TCSASOFT'): tcsetattr_flags |= termios.TCSASOFT try: termios.tcsetattr(fd, tcsetattr_flags, new) passwd = _raw_input(prompt, stream, input=input) finally: termios.tcsetattr(fd, tcsetattr_flags, old) stream.flush() # issue7208 except termios.error, e: if passwd is not None: # _raw_input succeeded. The final tcsetattr failed. Reraise # instead of leaving the terminal in an unknown state. raise # We can't control the tty or stdin. Give up and use normal IO. # fallback_getpass() raises an appropriate warning. del input, tty # clean up unused file objects before blocking passwd = fallback_getpass(prompt, stream) stream.write('\n') return passwd
def getnewpass(hub, username): for i in range(3): basemessage = "new password for user %s:" %(username) password = py.std.getpass.getpass(basemessage) password2 = py.std.getpass.getpass("repeat " + basemessage)
src/d/e/devpi-server-1.2.2/devpi_server/db.py devpi-server(Download)
return 1 for i in range(3): pwd = py.std.getpass.getpass("enter password for %s: " % user) pwd2 = py.std.getpass.getpass("repeat password for %s: " % user) if pwd != pwd2:
src/d/e/devpi-client-1.2.2/devpi/login.py devpi-client(Download)
password = args.password if password is None: password = py.std.getpass.getpass("password for user %s: " % user) input = dict(user=user, password=password) r = hub.http_api("post", hub.current.login, input, quiet=False)