urllib2, proxies, and pac files on OS X

Cameron Simpson cs at zip.com.au
Wed Apr 1 02:20:28 EDT 2009


On 30Mar2009 11:00, Mani Ghasemlou <mani at tungle.com> wrote:
| urllib2 correctly detects proxies as configured in my preferences pane
| on OS X 10.5:
[...]
| However, when configuring a proxy via PAC file, this does not seem to
| be the case:
[...]
| Is there any way to obtain (and parse using something like pacparser)
| the PAC file via urllib2 (or some other standard python library), or
| is this something I need to tackle using Cocoa (in my case PyObjC)?

You'll need a JavaScript interpreter. A PAC file contains a JavaScript
function that is run _per_URL_ to decide what proxy, if any, to use for
that particular fetch. Clearly you can't get a static proxy description
in the general case.
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

Look, Dave...  I can see you're really upset about this...  I honestly think
you ought to sit down calmly, ... take a stress pill, and think things over.
        - HAL, _2001_



More information about the Python-list mailing list