URL

Overview

URL is a class in Aspose.HTML FOSS for Python.

URL and URLSearchParams classes enable WHATWG‑style URL parsing and query‑parameter manipulation.

This class declares 7 methods for URL objects in Python programs. Available methods include: __eq__, __hash__, __init__, __repr__, __str__, can_parse, parse. Public members are accessible to any Python application after installing the Aspose.HTML FOSS for Python package. Properties: hash, host, hostname, href, origin, password, and 6 more.

Properties

NameTypeAccessDescription
hrefstrRead/WriteReturn the serialized URL string.
protocolstrRead/WriteGets or sets the protocol.
usernamestrRead/WriteReturn username from URL userinfo.
passwordstrRead/WriteReturn password from URL userinfo.
hoststrRead/WriteGets or sets the host.
hostnamestrRead/WriteGets or sets the hostname.
portstrRead/WriteGets or sets the port.
pathnamestrRead/WriteGets or sets the pathname.
searchstrRead/WriteGets or sets the search.
hashstrRead/WriteGets or sets the hash.
originstrReadGets the origin.
search_paramsURLSearchParamsReadGets the search params.

Methods

SignatureDescription
parse(input: str, base: str | "URL" | None) → "URL | None"Return a URL instance, or None if the input is invalid.
can_parse(input: str, base: str | "URL" | None) → boolReturn True when URL construction would succeed.
__init__(href: str, base: str | "URL" | None)Calls init(href, base) on this URL instance.
__str__() → strCalls str on this URL instance.
__repr__() → strCalls repr on this URL instance.
__eq__(other: object) → boolCalls eq(other) on this URL instance.
__hash__() → intCalls hash on this URL instance.

See Also