(url, scheme='', allow_fragments=1)
return tuple
Parse a URL into 5 components:
    <scheme>://<netloc>/<path>?<query>#<fragment>
    Return a 5-tuple: (scheme, netloc, path, query, fragment).
    Note that we don't break the components up in smaller bits
    (e.g. netloc is a single string) and we don't expand % escapes.
Parse a URL into 5 components:
    <scheme>://<netloc>/<path>?<query>#<fragment>
    Return a 5-tuple: (scheme, netloc, path, query, fragment).
    Note that we don't break the components up in smaller bits
    (e.g. netloc is a single string) and we don't expand % escapes.
Parse a URL into 5 components : <scheme > : // <netloc > / <path > ?<query > #<fragment > Return a 5 - tuple : ( scheme netloc path query fragment ) . Note that we don t break the components up in smaller bits ( e . g . netloc is a single string ) and we don t expand % escapes .
def urlsplit(url, scheme='', allow_fragments=1):
    """Parse a URL into 5 components:
    <scheme>://<netloc>/<path>?<query>#<fragment>
    Return a 5-tuple: (scheme, netloc, path, query, fragment).
    Note that we don't break the components up in smaller bits
    (e.g. netloc is a single string) and we don't expand % escapes."""
    key = url, scheme, allow_fragments
    cached = _parse_cache.get(key, None)
    if cached:
        return cached
    if len(_parse_cache) >= MAX_CACHE_SIZE: # avoid runaway growth
        clear_cache()
    netloc = query = fragment = ''
    i = string.find(url, ':')
    if i > 0:
        if url[:i] == 'http': # optimize the common case
            scheme = string.lower(url[:i])
            url = url[i+1:]
            if url[:2] == '//':
                i = string.find(url, '/', 2)
                if i < 0:
                    i = string.find(url, '#')
                    if i < 0:
                        i = len(url)
                netloc = url[2:i]
                url = url[i:]
            if allow_fragments and '#' in url:
                url, fragment = string.split(url, '#', 1)
            if '?' in url:
                url, query = string.split(url, '?', 1)
            tuple = scheme, netloc, url, query, fragment
            _parse_cache[key] = tuple
            return tuple
        for c in url[:i]:
            if c not in scheme_chars:
                break
        else:
            scheme, url = string.lower(url[:i]), url[i+1:]
    if scheme in uses_netloc:
        if url[:2] == '//':
            i = string.find(url, '/', 2)
            if i < 0:
                i = len(url)
            netloc, url = url[2:i], url[i:]
    if allow_fragments and scheme in uses_fragment and '#' in url:
        url, fragment = string.split(url, '#', 1)
    if scheme in uses_query and '?' in url:
        url, query = string.split(url, '?', 1)
    tuple = scheme, netloc, url, query, fragment
    _parse_cache[key] = tuple
    return tuple
def urlsplit ( url , scheme = '' , allow_fragments = 1 ) : key = url , scheme , allow_fragments cached = _parse_cache . get ( key , None ) if cached : return cached if len ( _parse_cache ) >= MAX_CACHE_SIZE : # avoid runaway growth clear_cache ( ) netloc = query = fragment = '' i = string . find ( url , ':' ) if i > 0 : if url [ : i ] == 'http' : # optimize the common case scheme = string . lower ( url [ : i ] ) url = url [ i + 1 : ] if url [ : 2 ] == '//' : i = string . find ( url , '/' , 2 ) if i < 0 : i = string . find ( url , '#' ) if i < 0 : i = len ( url ) netloc = url [ 2 : i ] url = url [ i : ] if allow_fragments and '#' in url : url , fragment = string . split ( url , '#' , 1 ) if '?' in url : url , query = string . split ( url , '?' , 1 ) tuple = scheme , netloc , url , query , fragment _parse_cache [ key ] = tuple return tuple for c in url [ : i ] : if c not in scheme_chars : break else : scheme , url = string . lower ( url [ : i ] ) , url [ i + 1 : ] if scheme in uses_netloc : if url [ : 2 ] == '//' : i = string . find ( url , '/' , 2 ) if i < 0 : i = len ( url ) netloc , url = url [ 2 : i ] , url [ i : ] if allow_fragments and scheme in uses_fragment and '#' in url : url , fragment = string . split ( url , '#' , 1 ) if scheme in uses_query and '?' in url : url , query = string . split ( url , '?' , 1 ) tuple = scheme , netloc , url , query , fragment _parse_cache [ key ] = tuple return tuple