All higher level subnet and network operations can be found in objects
of classes CIDR, IPRange and Wildcard.
There are handy helper methods here, (.cidr(),
.iprange() and .wildcard()) that return
pre-initialised objects of those classes without you having to call them
explicitly.
See those classes for details on the functionality they provide.
|
|
|
|
|
is_netmask(self)
Returns:
True if this addr is a mask that would return a host id,
False otherwise. |
source code
|
|
|
|
netmask_bits(self)
Returns:
If this address is a valid netmask, the number of non-zero bits are
returned, otherwise it returns the width in bits for based on the
version, 32 for IPv4 and 128 for IPv6. |
source code
|
|
|
|
|
|
|
is_hostmask(self)
Returns:
True if this address is a mask that would return a host
id, False otherwise. |
source code
|
|
|
|
hostname(self)
Returns:
Returns the FQDN for this IP address via a DNS query using
gethostbyaddr() Python's socket module. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
ipv4(self)
Returns:
A new version 4 IP object numerically equivalent this address. |
source code
|
|
|
|
ipv6(self,
ipv4_compatible=False)
Please Note: the IPv4-Mapped IPv6 address format is now
considered deprecated. |
source code
|
|
|
|
|
|
|
is_loopback(self)
Returns:
True if this IP is loopback address (not for network
transmission), False otherwise. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
info(self)
Returns:
A record dict containing IANA registration details for this IP
address if available, None otherwise. |
source code
|
|
|
|
|
|
|
|
|
Inherited from object:
__delattr__,
__getattribute__,
__new__,
__reduce__,
__reduce_ex__,
__setattr__
|
|
|
__add__(self,
other)
Returns:
A new (potentially larger) Addr class/subclass instance. |
source code
|
|
|
|
__and__(self,
other)
Returns:
bitwise AND (x & y) between the integer value of this address and
another. |
source code
|
|
|
|
__eq__(self,
other)
Returns:
True if this address is numerically the same as other,
False otherwise. |
source code
|
|
|
|
__ge__(self,
other)
Returns:
True if this address is numerically greater or equal in
value to other, False otherwise. |
source code
|
|
|
|
__getitem__(self,
index)
Returns:
The integer value of the word referenced by index (both positive and
negative). |
source code
|
|
|
|
__gt__(self,
other)
Returns:
True if this address is numerically greater in value
than other, False otherwise. |
source code
|
|
|
|
|
|
|
__hex__(self)
Returns:
hexadecimal string representation of this address (in network byte
order). |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
__le__(self,
other)
Returns:
True if this address is numerically lower or equal in
value to other, False otherwise. |
source code
|
|
|
|
|
|
|
|
|
|
__lshift__(self,
numbits)
Returns:
an address based on this one with its integer value left shifted by x
bits. |
source code
|
|
|
|
__lt__(self,
other)
Returns:
True if this address is numerically lower in value than
other, False otherwise. |
source code
|
|
|
|
__ne__(self,
other)
Returns:
False if this address is numerically the same as the
other, True otherwise. |
source code
|
|
|
|
__nonzero__(self)
Returns:
True if the numerical value of this address is not zero, False
otherwise. |
source code
|
|
|
|
__or__(self,
other)
Returns:
bitwise OR (x | y) between the integer value of this IP address and
another. |
source code
|
|
|
|
__rshift__(self,
numbits)
Returns:
an address based on this one with its integer value right shifted by
x bits. |
source code
|
|
|
|
__setitem__(self,
index,
value)
Sets the value of the word referenced by index in this address |
source code
|
|
|
|
__sub__(self,
other)
Returns:
A new (potentially smaller) Addr class/subclass instance. |
source code
|
|
|
|
__xor__(self,
other)
Returns:
bitwise exclusive OR (x ^ y) between the integer value of this
address and another. |
source code
|
|
|
|
bin(self)
Returns:
standard Python binary representation of this address. |
source code
|
|
|
|
bits(self,
word_sep=None)
Returns:
human-readable binary digit string of this address |
source code
|
|
|
|
|