| Methods inherited from BaseHandler:
| lt(self, other)
| add_parent(self, parent)
| close(self)

这样就方便来操作代理了,代码如下:

import urllib2
proxy_info = {
    'user' : 'username',
    'pass' : 'password',
    'host' : "secproxy.test.com",
    'port' : 8080
         	}
# build a new opener that uses a proxy requiring authorization
proxy_support = urllib2.ProxyHandler({"http" : 
"http://%(user)s:%(pass)[email protected]%(host)s:%(port)d" % proxy_info})
opener = urllib2.build_opener(proxy_support, urllib2.HTTPHandler)
# install it
urllib2.install_opener(opener)