ietfparse/algorithms.py
def remove_url_auth(url):
    """
    Removes the user & password and returns them along with a new url.

    :param str url: the URL to sanitize
    :return: a :class:`tuple` containing the authorization portion and
        the sanitized URL.  The authorization is a simple user & password
        :class:`tuple`.

    >>> auth, sanitized = remove_url_auth('http://foo:bar@example.com')
    >>> auth
    ('foo', 'bar')
    >>> sanitized
    'http://example.com'

    The return value from this function is simple named tuple with the
    following fields:

    - *auth* the username and password as a tuple
    - *username* the username portion of the URL or :data:`None`
    - *password* the password portion of the URL or :data:`None`
    - *url* the sanitized URL

    >>> result = remove_url_auth('http://me:secret@example.com')
    >>> result.username
    'me'
    >>> result.password
    'secret'
    >>> result.url
    'http://example.com'

    """
    parts = parse.urlsplit(url)
    return RemoveUrlAuthResult(auth=(parts.username or None, parts.password),
                               url=rewrite_url(url, user=None, password=None))
def remove_url_auth(url):
    parts = parse.urlsplit(url)
    return RemoveUrlAuthResult(auth=(parts.username or None, parts.password),
                               url=rewrite_url(url, user=None, password=None))
def remove_url_auth ( url ) : parts = parse . urlsplit ( url ) return RemoveUrlAuthResult ( auth = ( parts . username or None , parts . password ) , url = rewrite_url ( url , user = None , password = None ) )
Removes the user & password and returns them along with a new url.

    :param str url: the URL to sanitize
    :return: a :class:`tuple` containing the authorization portion and
        the sanitized URL.  The authorization is a simple user & password
        :class:`tuple`.

    >>> auth, sanitized = remove_url_auth('http://foo:bar@example.com')
    >>> auth
    ('foo', 'bar')
    >>> sanitized
    'http://example.com'

    The return value from this function is simple named tuple with the
    following fields:

    - *auth* the username and password as a tuple
    - *username* the username portion of the URL or :data:`None`
    - *password* the password portion of the URL or :data:`None`
    - *url* the sanitized URL

    >>> result = remove_url_auth('http://me:secret@example.com')
    >>> result.username
    'me'
    >>> result.password
    'secret'
    >>> result.url
    'http://example.com'
Removes the user & password and returns them along with a new url .