(self, original_url, allow_netrc=True,
                             allow_keyring=True)
return username, password
Find and return credentials for the specified URL.
Find and return credentials for the specified URL.
Find and return credentials for the specified URL .
def _get_new_credentials(self, original_url, allow_netrc=True,
                             allow_keyring=True):
        """Find and return credentials for the specified URL."""
        # Split the credentials and netloc from the url.
        url, netloc, url_user_password = split_auth_netloc_from_url(
            original_url)

        # Start with the credentials embedded in the url
        username, password = url_user_password
        if username is not None and password is not None:
            logger.debug("Found credentials in url for %s", netloc)
            return url_user_password

        # Find a matching index url for this request
        index_url = self._get_index_url(url)
        if index_url:
            # Split the credentials from the url.
            index_info = split_auth_netloc_from_url(index_url)
            if index_info:
                index_url, _, index_url_user_password = index_info
                logger.debug("Found index url %s", index_url)

        # If an index URL was found, try its embedded credentials
        if index_url and index_url_user_password[0] is not None:
            username, password = index_url_user_password
            if username is not None and password is not None:
                logger.debug("Found credentials in index url for %s", netloc)
                return index_url_user_password

        # Get creds from netrc if we still don't have them
        if allow_netrc:
            netrc_auth = get_netrc_auth(original_url)
            if netrc_auth:
                logger.debug("Found credentials in netrc for %s", netloc)
                return netrc_auth

        # If we don't have a password and keyring is available, use it.
        if allow_keyring:
            # The index url is more specific than the netloc, so try it first
            kr_auth = (_get_keyring_auth(index_url, username) or
                       _get_keyring_auth(netloc, username))
            if kr_auth:
                logger.debug("Found credentials in keyring for %s", netloc)
                return kr_auth

        return username, password
def _get_new_credentials ( self , original_url , allow_netrc = True , allow_keyring = True ) : # Split the credentials and netloc from the url. url , netloc , url_user_password = split_auth_netloc_from_url ( original_url ) # Start with the credentials embedded in the url username , password = url_user_password if username is not None and password is not None : logger . debug ( "Found credentials in url for %s" , netloc ) return url_user_password # Find a matching index url for this request index_url = self . _get_index_url ( url ) if index_url : # Split the credentials from the url. index_info = split_auth_netloc_from_url ( index_url ) if index_info : index_url , _ , index_url_user_password = index_info logger . debug ( "Found index url %s" , index_url ) # If an index URL was found, try its embedded credentials if index_url and index_url_user_password [ 0 ] is not None : username , password = index_url_user_password if username is not None and password is not None : logger . debug ( "Found credentials in index url for %s" , netloc ) return index_url_user_password # Get creds from netrc if we still don't have them if allow_netrc : netrc_auth = get_netrc_auth ( original_url ) if netrc_auth : logger . debug ( "Found credentials in netrc for %s" , netloc ) return netrc_auth # If we don't have a password and keyring is available, use it. if allow_keyring : # The index url is more specific than the netloc, so try it first kr_auth = ( _get_keyring_auth ( index_url , username ) or _get_keyring_auth ( netloc , username ) ) if kr_auth : logger . debug ( "Found credentials in keyring for %s" , netloc ) return kr_auth return username , password