On this page
ipaddress.IPv6Address
Prev: ipaddress.IPv4Network | Up: ipaddress | Next: ipaddress.IPv6Interface
Rel: ipaddress.AddressValueError, ipaddress.collapse_addresses, ipaddress.get_mixed_type_key, ipaddress.ip_address
Ref: docs.python.org — ipaddress.IPv6Address
Tags: #public #python3 #stdlib #ipaddress
Import
import ipaddress
from ipaddress import IPv6Address
Signature & Overview
ipaddress.IPv6Address(address)
Represent and manipulate single IPv6 Addresses.
Methods & Attributes
IPv6Address.compressed(...)— Return the shorthand version of the IP address as a string.IPv6Address.exploded(...)— Return the longhand version of the IP address as a string.IPv6Address.ipv4_mapped(...)— Return the IPv4 mapped address.IPv6Address.is_global(...)—Trueif the address is defined as globally reachable by iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_ (for IPv6) with the following exception:IPv6Address.is_link_local(...)— Test if the address is reserved for link-local.IPv6Address.is_loopback(...)— Test if the address is a loopback address.IPv6Address.is_multicast(...)— Test if the address is reserved for multicast use.IPv6Address.is_private(...)—Trueif the address is defined as not globally reachable by iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_ (for IPv6) with the following exceptions:IPv6Address.is_reserved(...)— Test if the address is otherwise IETF reserved.IPv6Address.is_site_local(...)— Test if the address is reserved for site-local.IPv6Address.is_unspecified(...)— Test if the address is unspecified.IPv6Address.packed(...)— The binary representation of this address.IPv6Address.reverse_pointer(...)— The name of the reverse DNS pointer for the IP address, e.g.: >>> ipaddress.ip_address("127.0.0.1").reverse_pointer '1.0.0.127.in-addr.arpa'IPv6Address.scope_id(...)— Identifier of a particular zone of the address's scope.IPv6Address.sixtofour(...)— Return the IPv4 6to4 embedded address.IPv6Address.teredo(...)— Tuple of embedded teredo IPs.
Usage
import ipaddress
ip = ipaddress.IPv6Address("::1")
assert ip.is_loopback and ip.exploded == "0000:0000:0000:0000:0000:0000:0000:0001"
Gotchas
- Handles compressed
::notation and.compressed/.explodedformatting automatically.
REPL Inspect
from ipaddress import IPv6Address
help(IPv6Address)
Linked from
Related notes
- tuts/python3/stdlib_module/ipaddress/IPv4Network Linked here; links to this page; shared tags: #ipaddress, #stdlib
- tuts/python3/stdlib_module/ipaddress/IPv6Interface Linked here; links to this page; shared tags: #ipaddress, #stdlib
- tuts/python3/stdlib_module/ipaddress Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/ipaddress/AddressValueError Linked here; shared tags: #ipaddress, #stdlib
- tuts/python3/stdlib_module/ipaddress/collapse_addresses Linked here; shared tags: #ipaddress, #stdlib
- tuts/python3/stdlib_module/ipaddress/get_mixed_type_key Linked here; shared tags: #ipaddress, #stdlib
- tuts/python3/stdlib_module/ipaddress/ip_address Linked here; shared tags: #ipaddress, #stdlib
- tuts/python3/stdlib_module/ipaddress/ip_interface shared tags: #ipaddress, #stdlib
- tuts/python3/stdlib_module/ipaddress/ip_network shared tags: #ipaddress, #stdlib
- tuts/python3/stdlib_module/ipaddress/IPv4Address shared tags: #ipaddress, #stdlib