コード例 #1
0
def get_password(user_name):

    passwd = None
    try:
        with LOCK:
            store = Keyring()
            passwd = store.get_password('mail', user_name)
    except Exception:
        logging.exception('failed getting password')

    return passwd
コード例 #2
0
ファイル: offlineimap.py プロジェクト: bboozzoo/dotfiles
def get_password(user_name):

    passwd = None
    try:
        with LOCK:
            store = Keyring()
            passwd = store.get_password('mail', user_name)
    except Exception:
        logging.exception('failed getting password')

    return passwd
コード例 #3
0
def set_password(user_name):
    import getpass
    import keyring

    passwd = None

    pw = getpass.getpass('password for %s: ' % (user_name))
    if pw:
        passwd = pw

    if passwd:
        try:
            with LOCK:
                store = Keyring()
                store.set_password('mail', user_name, passwd)
        except Exception:
            logging.exception('failed setting password')

    return passwd
コード例 #4
0
ファイル: offlineimap.py プロジェクト: bboozzoo/dotfiles
def set_password(user_name):
    import getpass
    import keyring

    passwd = None

    pw = getpass.getpass('password for %s: ' % (user_name))
    if pw:
        passwd = pw

    if passwd:
        try:
            with LOCK:
                store = Keyring()
                store.set_password('mail', user_name, passwd)
        except Exception:
            logging.exception('failed setting password')


    return passwd