capybara/utils.py
def normalize_url(url):
    """
    Returns the given URL with all query keys properly escaped.

    Args:
        url (str): The URL to normalize.

    Returns:
        str: The normalized URL.
    """

    uri = urlparse(url)
    query = uri.query or ""

    pairs = parse_qsl(query)
    decoded_pairs = [(unquote(key), value) for key, value in pairs]
    encoded_pairs = [(quote(key), value) for key, value in decoded_pairs]
    normalized_query = urlencode(encoded_pairs)

    return ParseResult(
        scheme=uri.scheme,
        netloc=uri.netloc,
        path=uri.path,
        params=uri.params,
        query=normalized_query,
        fragment=uri.fragment).geturl()
def normalize_url(url):
    uri = urlparse(url)
    query = uri.query or ""

    pairs = parse_qsl(query)
    decoded_pairs = [(unquote(key), value) for key, value in pairs]
    encoded_pairs = [(quote(key), value) for key, value in decoded_pairs]
    normalized_query = urlencode(encoded_pairs)

    return ParseResult(
        scheme=uri.scheme,
        netloc=uri.netloc,
        path=uri.path,
        params=uri.params,
        query=normalized_query,
        fragment=uri.fragment).geturl()
def normalize_url ( url ) : uri = urlparse ( url ) query = uri . query or "" pairs = parse_qsl ( query ) decoded_pairs = [ ( unquote ( key ) , value ) for key , value in pairs ] encoded_pairs = [ ( quote ( key ) , value ) for key , value in decoded_pairs ] normalized_query = urlencode ( encoded_pairs ) return ParseResult ( scheme = uri . scheme , netloc = uri . netloc , path = uri . path , params = uri . params , query = normalized_query , fragment = uri . fragment ) . geturl ( )
Returns the given URL with all query keys properly escaped.

    Args:
        url (str): The URL to normalize.

    Returns:
        str: The normalized URL.
Returns the given URL with all query keys properly escaped .