Skip to main content

split_domain_port

Return a (domain, port) tuple from a given host.

Returned domain is lowercased. If the host is invalid, the domain will be empty.

def split_domain_port(
host: string
) - > tuple

Return a (domain, port) tuple from a given host. Returned domain is lowercased. If the host is invalid, the domain will be empty.

Parameters

NameTypeDescription
hoststringThe raw host string containing the domain and optional port to be parsed and validated.

Returns

TypeDescription
tupleA tuple containing the lowercased domain string (with trailing dots removed) and the port string; returns two empty strings if the host is invalid.