IPy is a Python class and tools for handling of IPv4 and IPv6 addresses and networks. The script is similar to the Net::IP Perl module.
The IP class allows a comfortable parsing and handling for most notations in use for IPv4 and IPv6 Addresses and Networks. It was greatly inspired bei RIPE's Perl module NET::IP's interface but doesn't share the Implementation. It doesn't share non-CIDR netmasks, so funky stuff lixe a netmask 0xffffff0f can't be done here.
>>> from IPy import IP
>>> ip = IP('127.0.0.0/30')
>>> for x in ip:
... print x
...
127.0.0.0
127.0.0.1
127.0.0.2
127.0.0.3
>>> ip2 = IP('0x7f000000/30')
>>> ip == ip2
1
>>> ip.reverseNames()
['0.0.0.127.in-addr.arpa.', '1.0.0.127.in-addr.arpa.',
'2.0.0.127.in-addr.arpa.', '3.0.0.127.in-addr.arpa.']
>>> ip.reverseName()
'0-3.0.0.127.in-addr.arpa.'
>>> ip.iptype()
'PRIVATE'
What is new in this release:
- IP('::/0').netmask() gives IP('::') instead of IP('0.0.0.0')
What is new in version 0.74:
- Fix tests for Python 3.1 and 3.2
- ip.__nonzero__() and (ipa in ipb) return a bool instead of 0 or 1
- IP('0.0.0.0/0') + IP('0.0.0.0/0') raises an error, fix written by Arfrever
What is new in version 0.73:
- Support Python 3: setup.py runs 2to3
- Update the ranges for IPv6 IPs
- Fix reverseName() and reverseNames() for IPv4 in IPv6 addresses
- Drop support of Python < 2.5
What is new in version 0.71:
- Use xrange() instead of range()
- Use isinstance(x, int) instead of type(x) == types.IntType
- Prepare support of Python3 (use integer division: x // y)
- Fix IP(long) constructor: ensure that the address is not too large
- Constructor raise a TypeError if the type is not int, long, str or unicode
- 223.0.0.0/8 is now public (belongs to APNIC)
What is new in version 0.70:
- New "major" version because it may break compatibility
- Fix __cmp__(): IP('0.0.0.0/0') and IP('0.0.0.0') are not equal
- Fix IP.net() of the network "::/0": "::" instead of "0.0.0.0". IPy 0.63 should fix this bug, but it wasn't.
What is new in version 0.64:
- Create MANIFEST.in to fix setup.py bdist_rpm, fix by Robert Nickel
What is new in version 0.63:
- Fix formatting of "IPv4 in IPv6" network, eg. IP('::ffff:192.168.10.0/120'), the netmask ("/120" in the example) was missing!
- Fix IP.net() of the network "::/0": "::" instead of "0.0.0.0"
Requirements:
- Python
Comments not found