# Path: resources/lib/PhoneBooks/pyicloud/exceptions.py
# class NoStoredPasswordAvailable(PyiCloudException):
#     pass


import getpass
from .exceptions import NoStoredPasswordAvailable

#import keyring
# uses windows specific stuff

KEYRING_SYSTEM = 'pyicloud://icloud-password'


def get_password(username, interactive=False):#sys.stdout.isatty()):    #isatty -> not usable for xbmcout
    try:
        return get_password_from_keyring(username)
    except NoStoredPasswordAvailable:
        if not interactive:
            raise

        return getpass.getpass(
            'Enter iCloud password for {username}: '.format(
                username=username,
            )
        )


def password_exists_in_keyring(username):
    try:
        get_password_from_keyring(username)

# Path: resources/lib/PhoneBooks/pyicloud/exceptions.py
# class NoStoredPasswordAvailable(PyiCloudException):
#     pass


# Path: resources/lib/PhoneBooks/pyicloud/utils.py
import getpass
from .exceptions import NoStoredPasswordAvailable


#import keyring
# uses windows specific stuff

KEYRING_SYSTEM = 'pyicloud://icloud-password'


def get_password(username, interactive=False):#sys.stdout.isatty()):    #isatty -> not usable for xbmcout
    try:
        return get_password_from_keyring(username)
    except NoStoredPasswordAvailable:
        if not interactive:
            raise

        return getpass.getpass(
            'Enter iCloud password for {username}: '.format(
                username=username,
            )
        )


def password_exists_in_keyring(username):
    try:
        get_password_from_keyring(username)

    except NoStoredPasswordAvailable: