resolve_ips_async

async privex.helpers.net.resolve_ips_async(addr: Union[str, ipaddress.IPv4Address, ipaddress.IPv6Address], version: Union[str, int] = 'any', v4_convert=False) → List[str][source]

AsyncIO version of resolve_ips_async() - resolves the IPv4/v6 addresses for a given host (addr)

Parameters
  • addr (str|IPv4Address|IPv6Address) – The hostname to resolve. If an IPv4 / IPv6 address is passed instead of a hostname, it will be validated against version, then returned in a single item list.

  • version (str|int) –

    Default: 'any' - Return both IPv4 and IPv6 addresses (if both are found). If an IP address is passed, then both IPv4 and IPv6 addresses will be accepted. If set to one of the IPv4/IPv6 version choices, then a passed IP of the wrong version will raise AttributeError

    Choices:

    • IPv4 Options: 4 (int), 'v4', '4' (str), 'ipv4', 'inet', 'inet4'

    • IPv6 Options: 6 (int), 'v6', '6' (str), 'ipv6', 'inet6'

  • v4_convert (bool) – (Default: False) If set to True, will allow IPv6-wrapped IPv4 addresses starting with ::ffff: to be returned when requesting version v6 from an IPv4-only hostname.

Raises

AttributeError – Raised when an IPv4 address is passed and version is set to IPv6 - as well as vice versa (IPv6 passed while version is set to IPv4)

Return List[str] ips

Zero or more IP addresses in a list of str’s