Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
username = command_line.username
password = command_line.password
if username and command_line.delete_from_keyring:
utils.delete_password_in_keyring(username)
failure_count = 0
while True:
# Which password we use is determined by your username, so we
# do need to check for this first and separately.
if not username:
parser.error('No username supplied')
if not password:
password = utils.get_password(
username,
interactive=command_line.interactive
)
if not password:
parser.error('No password supplied')
try:
api = pyicloud.PyiCloudService(
username.strip(),
password.strip()
)
if (
not utils.password_exists_in_keyring(username) and
command_line.interactive and
confirm("Save password in keyring? ")