Module ipaddr
[show private | hide private]
[frames | no frames]

Module ipaddr

An IPv4/IPv6 manipulation library in Python.

This library is used to create/poke/manipulate IPv4 and IPv6 addresses and prefixes.
Classes
BaseIP A generic IP object.
IPv4 This class represents and manipulates 32-bit IPv4 addresses.
IPv6 This class respresents and manipulates 128-bit IPv6 addresses.

Exceptions
Error Base class for exceptions.
IPAddressExclusionError An Error we should never see occurred in address exclusion.
IPTypeError Tried to perform a v4 action on v6 object or vice versa.
IPv4IpValidationError Raised when an IPv4 address is invalid.
IPv4NetmaskValidationError Raised when a netmask is invalid.
IPv6IpValidationError Raised when an IPv6 address is invalid.
IPv6NetmaskValidationError Raised when an IPv6 netmask is invalid.
PrefixlenDiffInvalidError Raised when Sub/Supernets is called with a bad prefixlen_diff.

Function Summary
  CollapseAddrList(addresses)
Collapse a list of IP objects.
  IP(ipaddr)
Take an IP string/int and return an object of the correct type.

Variable Summary
str __version__ = '1.0.2'

Function Details

CollapseAddrList(addresses)

Collapse a list of IP objects.

Example:
    CollapseAddrList([IPv4('1.1.0.0/24'), IPv4('1.1.1.0/24')]) ->
      [IPv4('1.1.0.0/23')]

Args:
    addresses: A list of IPv4 or IPv6 objects.

Returns:
    A list of IPv4 or IPv6 objects depending on what we were passed.

IP(ipaddr)

Take an IP string/int and return an object of the correct type.

Args:
    ipaddr: A string or integer, the IP address.  Either IPv4 or
      IPv6 addresses may be supplied; integers less than 2**32 will
      be considered to be IPv4.

Returns:
    An IPv4 or IPv6 object.

Raises:
    ValueError: if the string passed isn't either a v4 or a v6
      address.

Variable Details

__version__

Type:
str
Value:
'1.0.2'                                                                

Generated by Epydoc 2.1 on Tue Feb 3 11:02:37 2009 http://epydoc.sf.net