MCPcopy Create free account
hub / github.com/EasyIME/PIME / split_host_and_port

Function split_host_and_port

python/python3/tornado/httputil.py:1029–1043  ·  view source on GitHub ↗

Returns ``(host, port)`` tuple from ``netloc``. Returned ``port`` will be ``None`` if not present. .. versionadded:: 4.1

(netloc: str)

Source from the content-addressed store, hash-verified

1027
1028
1029def split_host_and_port(netloc: str) -> Tuple[str, Optional[int]]:
1030 """Returns ``(host, port)`` tuple from ``netloc``.
1031
1032 Returned ``port`` will be ``None`` if not present.
1033
1034 .. versionadded:: 4.1
1035 """
1036 match = _netloc_re.match(netloc)
1037 if match:
1038 host = match.group(1)
1039 port = int(match.group(2)) # type: Optional[int]
1040 else:
1041 host = netloc
1042 port = None
1043 return (host, port)
1044
1045
1046def qs_to_qsl(qs: Dict[str, List[AnyStr]]) -> Iterable[Tuple[str, AnyStr]]:

Callers 1

__init__Method · 0.85

Calls 1

matchMethod · 0.45

Tested by

no test coverage detected