#NEWLINE# def credentials_prompt( self , realm , uri , username = None , password = None , * args , **kwargs ) : #NEWLINE# #INDENT# 'Prompt the user for credentials using the command line.\n\n        This will prompt the user, and then return the provided\n        username and password. This is used as a callback in the\n        API when the user requires authorization.\n        ' #NEWLINE# if ( ( username is None ) or ( password is None ) ) : #NEWLINE# #INDENT# if ( getattr ( self . options , 'diff_filename' , None ) == '-' ) : #NEWLINE# #INDENT# die ( 'HTTP authentication is required, but cannot be used with --diff-filename=-' ) #NEWLINE# #UNINDENT# if ( not sys . stdin . isatty ( ) ) : #NEWLINE# #INDENT# logging . error ( 'Authentication is required but input is not a tty.' ) #NEWLINE# if ( sys . platform == 'win32' ) : #NEWLINE# #INDENT# logging . info ( 'Check that you are not running this script from a Cygwin terminal emulator (or use Cygwin Python to run it).' ) #NEWLINE# #UNINDENT# raise CommandError ( 'Unable to log in to Review Board.' ) #NEWLINE# #UNINDENT# print ( ) #NEWLINE# print ( ( 'Please log in to the Review Board server at %s.' % urlparse ( uri ) [ 1 ] ) ) #NEWLINE# if ( username is None ) : #NEWLINE# #INDENT# sys . stderr . write ( 'Username: ' ) #NEWLINE# username = input ( ) #NEWLINE# #UNINDENT# if ( password is None ) : #NEWLINE# #INDENT# password = getpass . getpass ( b'Password: ' ) #NEWLINE# #UNINDENT# #UNINDENT# return ( username , password )