Making urllib2 work with proxy urls
John Bradbury
john_bradbury at skipthistalk21.com
Wed Apr 14 09:02:29 EDT 2004
I don't know if this helps, but this is what I do on Windows to connect via
a proxy server on Linux
os.environ["http_proxy"] = "http://192.168.0.1:3128"
John Bradbury
Tony Meyer wrote:
>> 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...
>
> I looked into this a little for SpamBayes a while back (there's still an
> open bug report...) and it's unfortunately even more complex than that.
> The automatic configuration javascript has access to some special
> functions that IE (etc) provide, so you'd need access to them as well, or
> for the OP to write their own versions of them (they're for dealing with
> IP ranges and that sort of thing).
>
> There's quite good documentation about it around, though, so it's easy to
> start. My suggestion would be that the OP look at the Mozilla code, since
> Firefox (and I presume Mozilla) can use automatic configuration scripts,
> and the source is somewhat easier to get hold of than the source to IE...
>
> =Tony Meyer
More information about the Python-list
mailing list