Package netaddr :: Module address
[frames] | no frames]

Module address

source code

classes and functions representing supported network addresses and associated aggregation options.

Classes
  Addr
A class whose objects represent network addresses of different types based on arguments passed to the constructor.
  EUI
A class whose objects represent IEEE Extended Unique Identifiers.
  IP
A class whose objects represent Internet Protocol network addresses that can be either IPv4 or IPv6.
  AddrRange
Represents a block of contiguous network addresses bounded by an arbitrary start and stop address.
  CIDR
Represents a block of contiguous IPv4/IPv6 network addresses defined by an IP address prefix and either a prefix mask measured in bits or alternatively a traditional subnet mask in IP address format.
  Wildcard
Represents a block of contiguous IPv4 network addresses defined using a wildcard/glob style syntax.
Functions
 
nrange(start, stop, step=1, klass=None)
A generator producing sequences of addresses based on start and stop values, in intervals of step.
source code
Function Details

nrange(start, stop, step=1, klass=None)

source code 

A generator producing sequences of addresses based on start and stop values, in intervals of step.

start - first network address as string or instance of Addr (sub)class.

stop - last network address as string or instance of Addr (sub)class.

step - (optional) size of step between addresses in range. Default is 1.

klass - (optional) a class used to create each object returned. Default: Addr objects.

a) str returns string representation of network address

b) int, long and hex return actual values

c) Addr (sub)class or duck type(*) return objects of that class.

(*) - if you use your own duck class, make sure you handle 2 arguments passed in (addr_value, addr_type) to avoid frustration.