#-*- conding:UTF-8 -*-
import urllib2 ,mimetools

# print urlparse.urlparse('ftp://image.baidu.com/picturelist/getpicture?from=1&column=%E6%97%85%E6%B8%B8&tag=%E6%9C%80%E7%BE%8E%E7%9A%84%E9%A3%8E%E6%99%AF&user_id=812046824&album_id=318176285')
# print urlparse.urlsplit('http://image.baidu.com/picturelist/getpicture?from=1&column=%E6%97%85%E6%B8%B8&tag=%E6%9C%80%E7%BE%8E%E7%9A%84%E9%A3%8E%E6%99%AF&user_id=812046824&album_id=318176285')
# print urllib.unquote('http://image.baidu.com/picturelist/getpicture?from=1&column=%E6%97%85%E6%B8%B8&tag=%E6%9C%80%E7%BE%8E%E7%9A%84%E9%A3%8E%E6%99%AF&user_id=812046824&album_id=318176285')

# fr = urllib2.urlopen("http://www.baidu.com")
# print fr.geturl()
# print fr.info()
# print fr.getcode()
# msg = mimetools.Message(fr)
# print msg.getencoding()
# print msg.getmaintype()
# print msg.getplist()

proxy_handler = urllib2.ProxyHandler({'http':'10.99.60.201:8080'})
proxy_auth_handler = urllib2.ProxyBasicAuthHandler()
proxy_auth_handler.add_password(realm = None,  
                          uri = 'https://10.99.60.201:8080', 
                          user = 'houwei' ,
                          passwd = 'messenger022783$$$$')

opener = urllib2.build_opener(proxy_handler ,proxy_auth_handler)
rsp = opener.open('http://www.baidu.com')
print rsp.geturl()
print rsp.info()
print rsp.getcode()
