(self, original_url)
return url, username, password
Return the credentials to use for the provided URL.

        If allowed, netrc and keyring may be used to obtain the
        correct credentials.

        Returns (url_without_credentials, username, password). Note
        that even if the original URL contains credentials, this
        function may return a different username and password.
Return the credentials to use for the provided URL.
Return the credentials to use for the provided URL .
def _get_url_and_credentials(self, original_url):
        """Return the credentials to use for the provided URL.

        If allowed, netrc and keyring may be used to obtain the
        correct credentials.

        Returns (url_without_credentials, username, password). Note
        that even if the original URL contains credentials, this
        function may return a different username and password.
        """
        url, netloc, _ = split_auth_netloc_from_url(original_url)

        # Use any stored credentials that we have for this netloc
        username, password = self.passwords.get(netloc, (None, None))

        if username is None and password is None:
            # No stored credentials. Acquire new credentials without prompting
            # the user. (e.g. from netrc, keyring, or the URL itself)
            username, password = self._get_new_credentials(original_url)

        if username is not None or password is not None:
            # Convert the username and password if they're None, so that
            # this netloc will show up as "cached" in the conditional above.
            # Further, HTTPBasicAuth doesn't accept None, so it makes sense to
            # cache the value that is going to be used.
            username = username or ""
            password = password or ""

            # Store any acquired credentials.
            self.passwords[netloc] = (username, password)

        assert (
            # Credentials were found
            (username is not None and password is not None) or
            # Credentials were not found
            (username is None and password is None)
        ), "Could not load credentials from url: {}".format(original_url)

        return url, username, password
def _get_url_and_credentials ( self , original_url ) : url , netloc , _ = split_auth_netloc_from_url ( original_url ) # Use any stored credentials that we have for this netloc username , password = self . passwords . get ( netloc , ( None , None ) ) if username is None and password is None : # No stored credentials. Acquire new credentials without prompting # the user. (e.g. from netrc, keyring, or the URL itself) username , password = self . _get_new_credentials ( original_url ) if username is not None or password is not None : # Convert the username and password if they're None, so that # this netloc will show up as "cached" in the conditional above. # Further, HTTPBasicAuth doesn't accept None, so it makes sense to # cache the value that is going to be used. username = username or "" password = password or "" # Store any acquired credentials. self . passwords [ netloc ] = ( username , password ) assert ( # Credentials were found ( username is not None and password is not None ) or # Credentials were not found ( username is None and password is None ) ) , "Could not load credentials from url: {}" . format ( original_url ) return url , username , password