The proxy support code in urllib is imho too specific and cannot easily support dynamic proxy configuration using a proxy.pac file.
That is, the code assumes that there is at most one proxy per protocol, while this is not quite true in practice. A proxy.pac can refer different URLs to different proxies (or exclude some from proxying).
This could be solved by adding a new proxy hook to urllib, something like:
def getproxies_for_url(url) -> [info, ...]
That is, the argument is the string for an URL, the result is a list of proxies that can be used to fetch the URL.
This hook would allow us to provide a hook on OSX that enables python scripts to use the system proxy settings, even when those are complex (such as by using proxy autoconfiguration).
|