• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

.dockerignoreD23-Nov-202330 43

.gitignoreD23-Nov-2023312 3730

.travis.ymlD23-Nov-2023300 1918

Android.bpD23-Nov-20231.2 KiB4440

LICENSED23-Nov-20232.5 KiB5141

MANIFEST.inD23-Nov-202353 32

METADATAD23-Nov-2023366 2019

MODULE_LICENSE_PSFD23-Nov-20230

MakefileD23-Nov-20231.1 KiB4632

OTHER_BACKPORTS.mdD23-Nov-20234.3 KiB5736

READMED23-Nov-2023921 2924

README.mdD23-Nov-2023921 2924

ipaddress.pyD23-Nov-202378 KiB2,4211,802

setup.cfgD23-Nov-202363 64

setup.pyD23-Nov-20231.2 KiB3630

test-python2.6.DockerfileD23-Nov-2023204 96

test-python2.7.DockerfileD23-Nov-2023256 129

test-python3.2.DockerfileD23-Nov-2023200 96

test-python3.3.DockerfileD23-Nov-2023202 96

test_ipaddress.pyD23-Nov-202393.1 KiB2,2381,789

README

1ipaddress
2=========
3
4Python 3.3+'s [ipaddress](http://docs.python.org/dev/library/ipaddress) for Python 2.6, 2.7, 3.2.
5
6This repository tracks the latest version from cpython, e.g. ipaddress from cpython 3.8 as of writing.
7
8Note that just like in Python 3.3+ you must use character strings and not byte strings for textual IP address representations:
9
10```python
11>>> from __future__ import unicode_literals
12>>> ipaddress.ip_address('1.2.3.4')
13IPv4Address(u'1.2.3.4')
14```
15or
16```python
17>>> ipaddress.ip_address(u'1.2.3.4')
18IPv4Address(u'1.2.3.4')
19```
20but not:
21```python
22>>> ipaddress.ip_address(b'1.2.3.4')
23Traceback (most recent call last):
24  File "<stdin>", line 1, in <module>
25  File "ipaddress.py", line 163, in ip_address
26    ' a unicode object?' % address)
27ipaddress.AddressValueError: '1.2.3.4' does not appear to be an IPv4 or IPv6 address. Did you pass in a bytes (str in Python 2) instead of a unicode object?
28```
29

README.md

1ipaddress
2=========
3
4Python 3.3+'s [ipaddress](http://docs.python.org/dev/library/ipaddress) for Python 2.6, 2.7, 3.2.
5
6This repository tracks the latest version from cpython, e.g. ipaddress from cpython 3.8 as of writing.
7
8Note that just like in Python 3.3+ you must use character strings and not byte strings for textual IP address representations:
9
10```python
11>>> from __future__ import unicode_literals
12>>> ipaddress.ip_address('1.2.3.4')
13IPv4Address(u'1.2.3.4')
14```
15or
16```python
17>>> ipaddress.ip_address(u'1.2.3.4')
18IPv4Address(u'1.2.3.4')
19```
20but not:
21```python
22>>> ipaddress.ip_address(b'1.2.3.4')
23Traceback (most recent call last):
24  File "<stdin>", line 1, in <module>
25  File "ipaddress.py", line 163, in ip_address
26    ' a unicode object?' % address)
27ipaddress.AddressValueError: '1.2.3.4' does not appear to be an IPv4 or IPv6 address. Did you pass in a bytes (str in Python 2) instead of a unicode object?
28```
29