March 2019
Beginner
490 pages
12h 40m
English
The next module that we are going to study allows us to manipulate the network address and the interoperability between IPv4 and IPv6. For example, given a certain IP address, we can obtain it in the v4 and v6 formats. The easiest way to install netaddr is to use pip. Download and install the latest version from the Python repository (http://pypi.python.org/pypi/pip) and run the following command:
pip install netaddr
Also, you can see the official source code repository here: https://github.com/drkjam/netaddr.
The following IPAddress object represents a single IP address v6:
>>> from netaddr import * >>> ipv6 = IPAddress('::1') >>> ipv6.version 6
We can check whether we have full support for the IPv6 protocol:
>>> ip = ...
Read now
Unlock full access