When using urllib2 (and maybe urllib) on windows python seems to magically pick up the authenticated proxy setting applied to InternetExplorer. However, it doesn't seem to check and process the Advance setting "Exceptions" list.
Is there a way I can get it to process the exceptions list? Or, ignore the IE proxy setting and apply my own proxy opener to address this issue?
I played with creating a proxy opener before, but couldn't get it to work. Here's what I managed to dig out, but I still don't see how/where to apply any exceptions and I'm not even sure if this is right:
proxy_info = {
'host':'myproxy.com',
'user':Username,
'pass':Password,
'port':1080
}
http_str = "http://%(user)s:%(pass)s@%(host)s:%(port)d" % proxy_info
authInfo = urllib2.HTTPBasicAuthHandler()
authInfo.add_password()
proxy_dict = {'http':http_str}
proxyHandler = urllib2.ProxyHandler(proxy_dict)
# apply the handler to an opener
proxy_opener = urllib2.build_opener(proxyHandler, urllib2.HTTPHandler)
urllib2.install_opener(proxy_opener)