url#
- class starlite.datastructures.url.Address#
Bases:
NamedTuple
Just a network address.
- starlite.datastructures.url.make_absolute_url(path: Union[str, URL], base: Union[str, URL]) str #
Create an absolute URL.
- Parameters:
path – URL path to make absolute
base – URL to use as a base
- Returns:
A string representing the new, absolute URL
- class starlite.datastructures.url.URL#
Bases:
object
Representation and modification utilities of a URL.
- __new__(url: Union[str, SplitResult]) URL #
Create a new instance.
- Parameters:
url – url string or split result to represent.
- classmethod from_components(scheme: str = '', netloc: str = '', path: str = '', fragment: str = '', query: str = '') URL #
Create a new URL from components.
- Parameters:
scheme – URL scheme
netloc – Network location
path – Hierarchical path
query – Query component
fragment – Fragment identifier
- Returns:
A new URL with the given components
- classmethod from_scope(scope: Scope) URL #
Construct a URL from a
Scope
- Parameters:
scope – A scope
- Returns:
A URL
- with_replacements(scheme: str = '', netloc: str = '', path: str = '', query: Optional[Union[str, MultiDict]] = None, fragment: str = '') URL #
Create a new URL, replacing the given components.
- Parameters:
scheme – URL scheme
netloc – Network location
path – Hierarchical path
query – Raw query string
fragment – Fragment identifier
- Returns:
A new URL with the given components replaced
- property query_params: MultiDict#
Query parameters of a URL as a
MultiDict
- Returns:
A
MultiDict
with query parameters
Notes
- The returned MultiDict is mutable,
URL
itself is immutable, therefore mutating the query parameters will not directly mutate the
URL
. If you want to modify query parameters, make modifications in the multidict and pass them back towith_replacements()
- The returned MultiDict is mutable,