RE: Making urllib2 work with proxy urls

Discussion in 'Python' started by Tony Meyer, Apr 14, 2004.

  1. Tony Meyer

    Tony Meyer Guest

    > 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
     
    Tony Meyer, Apr 14, 2004
    #1
    1. Advertising

  2. 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
     
    John Bradbury, Apr 14, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kaidi
    Replies:
    5
    Views:
    512
    Andrew Thompson
    Jan 4, 2004
  2. Anand Pillai

    Making urllib2 work with proxy urls

    Anand Pillai, Apr 13, 2004, in forum: Python
    Replies:
    2
    Views:
    994
  3. Nathan Sokalski

    Converting Relative URLs into Absolute URLs

    Nathan Sokalski, Aug 11, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    781
    Sriram Srivatsan
    Aug 12, 2008
  4. Adam Monsen

    JDBC URLs ...not really URLs?

    Adam Monsen, Feb 6, 2009, in forum: Java
    Replies:
    11
    Views:
    6,395
    Adam Monsen
    Feb 8, 2009
  5. Steve T.

    dynamic URLS convert to static URLS for search engines

    Steve T., Mar 1, 2004, in forum: ASP .Net Web Services
    Replies:
    7
    Views:
    325
    Steve T.
    Mar 4, 2004
Loading...

Share This Page