(url)
return url_norm
Produce a normalized, blockable url
Produce a normalized, blockable url
Produce a normalized blockable url
def normalize_url(url):
    """Produce a normalized, blockable url"""
    # Split the URL into parts
    url_parts = urllib.parse.urlsplit(url)
    # We don't need 'scheme' or 'fragment'
    base, path, qs = url_parts[1:4]
    # Sort the query string
    qs_norm = sort_querystring(qs)
    if qs_norm:
        qs_norm = '?' + qs_norm
    # Generate the normalized url
    url_norm = ''.join([base, path, qs_norm])
    return url_norm
def normalize_url ( url ) : # Split the URL into parts url_parts = urllib . parse . urlsplit ( url ) # We don't need 'scheme' or 'fragment' base , path , qs = url_parts [ 1 : 4 ] # Sort the query string qs_norm = sort_querystring ( qs ) if qs_norm : qs_norm = '?' + qs_norm # Generate the normalized url url_norm = '' . join ( [ base , path , qs_norm ] ) return url_norm