import urllib
protocol, s1 = urllib.splittype('http://www.freedom.com:8001/img/people')
# ('http', '//www.freedom.com:8001/img/people')
host, s2= urllib.splithost(s1)
# ('www.freedom.com:8001', '/img/people')
host, port = urllib.splitport(host)
# ('www.freedom.com', '8001')