Just want to note that this means we will need to drop Python 2.6 support:
python2.6
Python 2.6.8 (unknown, Mar 9 2014, 22:16:00)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from urlparse import urlparse
>>> urlparse('http://[::1]:80/').hostname
'['
>>> urlparse('http://[::1]:80/').port
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urlparse.py", line 102, in port
return int(port, 10)
ValueError: invalid literal for int() with base 10: ':1]:80'
Python 2.7 behaves correctly:
python2.7
Python 2.7.8 (v2.7.8:ee879c0ffa11, Jun 29 2014, 21:07:35)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from urlparse import urlparse
>>> urlparse('http://[::1]:80/').hostname
'::1'
>>> urlparse('http://[::1]:80/').port
80