def get_password(config):
    """Returns the password for a remote server

    It tries to fetch the password from the following
    locations in this order:

     1. config file [remote] section, password option
     2. GNOME keyring
     3. interactively, from the user
    """
    password = config.get_option('remote.password')

    if password == '':
        user = config.get_option('remote.user')
        url = config.get_option('remote.url')
        url_obj = urlparse.urlparse(url)
        server = url_obj.hostname
        protocol = url_obj.scheme

        if HAS_GNOME_KEYRING_SUPPORT:
            password = get_password_from_gnome_keyring(user, server, protocol)

        else:
            prompt = 'Enter %s password for %s at %s: ' % (get_app(), user,
                                                           server)
            password = getpass.getpass(prompt)

    return password
def get_password ( config ) : password = config . get_option ( 'remote.password' ) if password == '' : user = config . get_option ( 'remote.user' ) url = config . get_option ( 'remote.url' ) url_obj = urlparse . urlparse ( url ) server = url_obj . hostname protocol = url_obj . scheme if HAS_GNOME_KEYRING_SUPPORT : password = get_password_from_gnome_keyring ( user , server , protocol ) else : prompt = 'Enter %s password for %s at %s: ' % ( get_app ( ) , user , server ) password = getpass . getpass ( prompt ) return password
Returns the password for a remote server

    It tries to fetch the password from the following
    locations in this order:

     1. config file [remote] section, password option
     2. GNOME keyring
     3. interactively, from the user