MCPcopy
hub / github.com/urllib3/urllib3 / allowed_gai_family

Function allowed_gai_family

src/urllib3/util/connection.py:103–111  ·  view source on GitHub ↗

This function is designed to work in the context of getaddrinfo, where family=socket.AF_UNSPEC is the default and will perform a DNS search for both IPv6 and IPv4 records.

()

Source from the content-addressed store, hash-verified

101
102
103def allowed_gai_family() -> socket.AddressFamily:
104 """This function is designed to work in the context of
105 getaddrinfo, where family=socket.AF_UNSPEC is the default and
106 will perform a DNS search for both IPv6 and IPv4 records."""
107
108 family = socket.AF_INET
109 if HAS_IPV6:
110 family = socket.AF_UNSPEC
111 return family
112
113
114def _has_ipv6(host: str) -> bool:

Callers 3

create_connectionFunction · 0.85

Calls

no outgoing calls

Tested by 2