def interactive_config_setup(conffile, apiurl, initial=True): user = raw_input('Username: '******'user': user, 'pass': passwd} if apiurl: config['apiurl'] = apiurl write_initial_config(conffile, config, creds_mgr_descriptor=creds_mgr_descr) else: add_section(conffile, apiurl, user, passwd, creds_mgr_descriptor=creds_mgr_descr)
def select_credentials_manager_descr(): if not credentials.has_keyring_support(): print('To use keyrings please install python%d-keyring.' % sys.version_info.major) creds_mgr_descriptors = credentials.get_credentials_manager_descriptors() for i, creds_mgr_descr in enumerate(creds_mgr_descriptors, 1): print('%d) %s (%s)' % (i, creds_mgr_descr.name(), creds_mgr_descr.description()))# i = raw_input('Select credentials manager: ') if not i.isdigit(): sys.exit('Invalid selection') i = int(i) - 1 if i < 0 or i >= len(creds_mgr_descriptors): sys.exit('Invalid selection') return creds_mgr_descriptors[i]