Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > RE: Making urllib2 work with proxy urls

Reply
Thread Tools

RE: Making urllib2 work with proxy urls

 
 
Tony Meyer
Guest
Posts: n/a
 
      04-14-2004
> 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


 
Reply With Quote
 
 
 
 
John Bradbury
Guest
Posts: n/a
 
      04-14-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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JDBC URLs ...not really URLs? Adam Monsen Java 11 02-08-2009 08:14 PM
Converting Relative URLs into Absolute URLs Nathan Sokalski ASP .Net 1 08-12-2008 07:03 AM
Making urllib2 work with proxy urls Anand Pillai Python 2 04-14-2004 01:43 AM
dynamic URLS convert to static URLS for search engines Steve T. ASP .Net Web Services 7 03-04-2004 03:16 PM
Distinguish text URLs from non-text URLs? Kaidi Java 5 01-04-2004 10:15 AM



Advertisments