bobzhang/referencing/urllib does not have a README file

    ValueError

    pub(all) suberror ValueError {
    ValueError(String)
    } derive(Eq,
    Debug
    )

    Mirrors Python's builtin ValueError, as raised by urllib.parse (e.g. Invalid IPv6 URL). It is also reused by the root bobzhang/referencing package wherever upstream raises ValueError.
    impl Show for ValueError

    DefragResult

    pub(all) struct DefragResult {
    url : String
    fragment : String
    } derive(Eq,
    Debug
    )

    The result of urldefrag.

    DefragResult::geturl

    fn DefragResult::geturl(self : DefragResult) -> String

    Reassemble the URL (Python's DefragResult.geturl()).

    ParseResult

    pub(all) struct ParseResult {
    scheme : String
    netloc : String
    path : String
    params : String
    query : String
    fragment : String
    } derive(Eq,
    Debug
    )

    The result of urlparse, which additionally splits ;params off the path.

    ParseResult::geturl

    fn ParseResult::geturl(self : ParseResult) -> String

    Reassemble the URL (Python's ParseResult.geturl()).

    SplitResult

    pub(all) struct SplitResult {
    scheme : String
    netloc : String
    path : String
    query : String
    fragment : String
    } derive(Eq,
    Debug
    )

    The result of urlsplit: <scheme>://<netloc>/<path>?<query>#<fragment>.

    SplitResult::geturl

    fn SplitResult::geturl(self : SplitResult) -> String

    Reassemble the URL (Python's SplitResult.geturl()).

    unquote

    fn unquote(s : String) -> String

    Replace %xx escapes by their single-character equivalent, exactly like Python's urllib.parse.unquote(string) (UTF-8, errors='replace').

    Percent-encoded sequences are decoded as UTF-8, with invalid sequences replaced by U+FFFD. Only maximal runs of ASCII characters are decoded; non-ASCII characters pass through untouched.

    test {
    inspect(@urllib.unquote("abc%20def"), content="abc def")
    inspect(@urllib.unquote("%E2%82%AC%zz"), content="€%zz")
    }

    urldefrag

    fn urldefrag(url : String) -> DefragResult raise ValueError

    Remove any fragment from url, exactly like Python's urllib.parse.urldefrag.

    If the URL contains no #, it is returned unchanged with an empty fragment.

    urljoin

    fn urljoin(base : String, url : String, allow_fragments? : Bool) -> String raise ValueError

    Join a base URL and a possibly relative URL to form an absolute interpretation of the latter, exactly like Python's urllib.parse.urljoin(base, url, allow_fragments=True).

    This mirrors Python's quirks: relative resolution only happens when the scheme of url (defaulting to the base's) equals the base's scheme and is listed in uses_relative (so e.g. urn: and tag: bases are never joined against), the network location is only inherited for schemes in uses_netloc, and excess .. segments are dropped (RFC 3986).

    test {
    inspect(
    @urllib.urljoin("http://example.com/a/b", "../c"),
    content="http://example.com/c",
    )
    inspect(@urllib.urljoin("urn:example:foo", "#bar"), content="#bar")
    }

    urlparse

    fn urlparse(url : String, scheme? : String, allow_fragments? : Bool) -> ParseResult raise ValueError

    Parse a URL into 6 components, exactly like Python's urllib.parse.urlparse(url, scheme='', allow_fragments=True).

    urlsplit

    fn urlsplit(url : String, scheme? : String, allow_fragments? : Bool) -> SplitResult raise ValueError

    Parse a URL into 5 components, exactly like Python's urllib.parse.urlsplit(url, scheme='', allow_fragments=True).

    Raises ValueError for malformed bracketed (IPv6 / IPvFuture) hosts. Note that % escapes are not expanded.

    urlunparse

    fn urlunparse(scheme : String, netloc : String, path : String, params : String, query : String, fragment : String) -> String

    Combine URL components back into a URL string, exactly like Python's urllib.parse.urlunparse.

    urlunsplit

    fn urlunsplit(scheme : String, netloc : String, path : String, query : String, fragment : String) -> String

    Combine URL components back into a URL string, exactly like Python's urllib.parse.urlunsplit.

    uses_netloc

    let uses_netloc : ReadOnlyArray[String]

    Schemes which use a network location (Python's urllib.parse.uses_netloc).

    uses_params

    let uses_params : ReadOnlyArray[String]

    Schemes which support ;params (Python's urllib.parse.uses_params).

    uses_relative

    let uses_relative : ReadOnlyArray[String]

    Schemes for which urljoin resolves relative references (Python's urllib.parse.uses_relative).