Making urllib2 work with proxy urls
JanC
usenet_spam at janc.invalid
Tue Apr 13 21:43:36 EDT 2004
simoninusa2001 at yahoo.co.uk (simo) schreef:
> The pac file is usually just a script with the config data for
> browsers, it will return something like "PROXY
> http-proxy.mydomain.com:80"
>
> I very much doubt urllib2 can actually proces the .pac file.
>
> You should be able to open that file and figure out what you need to
> set the proxy variable to in urllib2 (or your ENVironment).
A PAC file is a script that defines a JavaScript function:
function FindProxyForURL(url, host) {
// based on url & host:
// return "DIRECT" to use no proxy, or something like
// return "PROXY proxy.example.com:8080" to use that proxy
}
This function can get quite complex, so to use it automaticly, you might
need a JavaScript engine...
--
JanC
"Be strict when sending and tolerant when receiving."
RFC 1958 - Architectural Principles of the Internet - section 3.9
More information about the Python-list
mailing list