def safe_url ( url ) : parsed = urlparse ( url ) if parsed . password is not None : pwd = ':%s@' % parsed . password url = url . replace ( pwd , ':*****@' ) return url
python urllib is there a way to bypass the username and password page
Remove password from printed connection URLs .
def safe_url(url):
    """Remove password from printed connection URLs."""
    parsed = urlparse(url)
    if parsed.password is not None:
        pwd = ':%s@' % parsed.password
        url = url.replace(pwd, ':*****@')
    return url