• Home
  • Raw
  • Download

Lines Matching refs:ipaddress

1 :mod:`ipaddress` --- IPv4/IPv6 manipulation library
4 .. module:: ipaddress
9 **Source code:** :source:`Lib/ipaddress.py`
13 :mod:`ipaddress` provides the capabilities to create, manipulate and
23 :ref:`ipaddress-howto`.
29 import ipaddress
30 from ipaddress import (
37 The :mod:`ipaddress` module provides factory functions to conveniently create
48 >>> ipaddress.ip_address('192.168.0.1')
50 >>> ipaddress.ip_address('2001:db8::')
64 >>> ipaddress.ip_network('192.168.0.0/28')
112 >>> ipaddress.IPv4Address('192.168.0.1')
114 >>> ipaddress.IPv4Address(3232235521)
116 >>> ipaddress.IPv4Address(b'\xC0\xA8\x00\x01')
174 >>> ipaddress.ip_address("127.0.0.1").reverse_pointer
176 >>> ipaddress.ip_address("2001:db8::1").reverse_pointer
238 >>> format(ipaddress.IPv4Address('192.168.0.1'))
240 >>> '{:#b}'.format(ipaddress.IPv4Address('192.168.0.1'))
242 >>> f'{ipaddress.IPv6Address("2001:db8::1000"):s}'
244 >>> format(ipaddress.IPv6Address('2001:db8::1000'), '_X')
246 >>> '{:#_n}'.format(ipaddress.IPv6Address('2001:db8::1000'))
276 >>> ipaddress.IPv6Address('2001:db8::1000')
278 >>> ipaddress.IPv6Address('ff02::5678%1')
360 >>> str(ipaddress.IPv4Address('192.168.0.1'))
362 >>> int(ipaddress.IPv4Address('192.168.0.1'))
364 >>> str(ipaddress.IPv6Address('::1'))
366 >>> int(ipaddress.IPv6Address('::1'))
411 ipaddress.AddressValueError: 4294967296 (>= 2**32) is not permitted as an IPv4 address
928 >>> ipaddress.ip_address(3221225985)
930 >>> ipaddress.v4_int_to_packed(3221225985)
952 >>> [ipaddr for ipaddr in ipaddress.summarize_address_range(
953 ... ipaddress.IPv4Address('192.0.2.0'),
954 ... ipaddress.IPv4Address('192.0.2.130'))]
966 ... ipaddress.collapse_addresses([ipaddress.IPv4Network('192.0.2.0/25'),
967 ... ipaddress.IPv4Network('192.0.2.128/25')])]
980 have :mod:`ipaddress` sort these anyway. If you need to do this, you can use