#NEWLINE# def _create_new_config( self ) : #NEWLINE# #INDENT# '\n        Prompt the user for configuration values. Test if the configuration is\n        valid by calling the /help/capabilities endpoint. If the configuration\n        is valid call write_config_value(). If the configuration is not valid\n        sys.exit(2) is called.\n        ' #NEWLINE# config_dict = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# config_dict [ 'server_ip' ] = input ( ( ( 'Please input the IP address or ' + 'the hostname of the server you ' ) + 'want to connect to: ' ) ) . strip ( ) #NEWLINE# choice = _choice ( ( ( ( ( 'Choose one of the following options for ' + 'authentication: \n' ) + '\t1. Authorization token (recommended).\n' ) + '\t2. Username and password.\n' ) + 'Choice: ' ) , valid_values = ( '1' , '2' ) ) #NEWLINE# if ( choice == '1' ) : #NEWLINE# #INDENT# config_dict [ 'auth_token' ] = input ( 'Please input authorization token: ' ) . strip ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# config_dict [ 'username' ] = input ( 'Username: ' ) . strip ( ) #NEWLINE# config_dict [ 'password' ] = getpass . getpass ( 'Password: ' ) #NEWLINE# #UNINDENT# certificate_file = _choice ( ( 'Enter path to TLS PEM certificate ' + '(optional): ' ) , optional = True , file_exists = True ) #NEWLINE# if ( certificate_file is not None ) : #NEWLINE# #INDENT# config_dict [ 'certificate_file' ] = certificate_file #NEWLINE# #UNINDENT# self . config [ self . config_section ] = config_dict #NEWLINE# self . _verify_config ( ) #NEWLINE# self . write_config_file ( )