module documentation

Undocumented

Function get​_current​_url Recreate the URL for a request. If an optional part isn't provided, it and subsequent parts are not included in the URL.
Function get​_host Return the host for the given parameters.
Function host​_is​_trusted Check if a host matches a list of trusted names.
def get_current_url(scheme, host, root_path=None, path=None, query_string=None):

Recreate the URL for a request. If an optional part isn't provided, it and subsequent parts are not included in the URL.

The URL is an IRI, not a URI, so it may contain Unicode characters. Use ~werkzeug.urls.iri_to_uri to convert it to ASCII.

Parameters
scheme:strThe protocol the request used, like "https".
host:strThe host the request was made to. See get_host.
root​_path:t.Optional[str]Prefix that the application is mounted under. This is prepended to path.
path:t.Optional[str]The path part of the URL after root_path.
query​_string:t.Optional[bytes]The portion of the URL after the "?".
Returns
strUndocumented
def get_host(scheme, host_header, server=None, trusted_hosts=None):

Return the host for the given parameters.

This first checks the host_header. If it's not present, then server is used. The host will only contain the port if it is different than the standard port for the protocol.

Optionally, verify that the host is trusted using host_is_trusted and raise a ~werkzeug.exceptions.SecurityError if it is not.

Parameters
scheme:strThe protocol the request used, like "https".
host​_header:t.Optional[str]The Host header value.
server:t.Optional[t.Tuple[str, t.Optional[int]]]Address of the server. (host, port), or (path, None) for unix sockets.
trusted​_hosts:t.Optional[t.Iterable[str]]A list of trusted host names.
Returns
strHost, with port if necessary.
Raises
~werkzeug.exceptions.SecurityErrorIf the host is not trusted.
def host_is_trusted(hostname, trusted_list):

Check if a host matches a list of trusted names.

New in version 0.9.
Parameters
hostname:strThe name to check.
trusted​_list:t.Iterable[str]A list of valid names to match. If a name starts with a dot it will match all subdomains.
Returns
boolUndocumented