in modular_cli/service/config.py [0:0]
def save_configuration(api_link: str, username: str, password: str) -> str:
if api_link.endswith('/'):
api_link = api_link[:-1]
valid_link = __api_link_validation(link=api_link)
folder_path = get_credentials_folder()
try:
folder_path.mkdir(exist_ok=True)
except OSError:
SYSTEM_LOG.exception(f'Creation of the directory {folder_path} failed')
raise ModularCliConfigurationException(
f'Could not create configuration folder {folder_path}'
)
config_data = dict(api_link=valid_link,
username=username,
password=password)
with open(folder_path / CREDENTIALS_FILE_NAME, 'w') as config_file:
yaml.dump(config_data, config_file)
return 'Great! The Modular-CLI tool has been setup.'