[Pythonmac-SIG] Getting PackageManager to work with a password proxy
Matt Duignan
mattduignan at yahoo.com
Wed Mar 10 21:54:32 EST 2004
Hi there,
Sorry if this is redundant information...
I was having trouble getting PackageManager to work
with the password authentication http proxy server
where I work (there is a firewall preventing direct
http access) - I thought I would share how I got it to
work.
The PackageManager help file said:
"Another potential problem source is that you are
behind a firewall. This version of PackageManager
uses the Unix method of setting a firewall: you
need
to set the environment variable http_proxy to
"http://proxyhost:port". See Apple Technical
Q&A QA1067 for instructions."
But this misses the username and password that I need
- it should be
"http://username:password@proxyhost:port" as Stuart
Bishop pointed out in this post:
http://mail.python.org/pipermail/pythonmac-sig/2003-July/008118.html
When I did that, PackageManager could now successfully
show me the packages available to install, but when I
selected install the Verbose output showed that curl
was failing with the proxy server - it turns out that
curl doesn't recognise the username:password syntax in
the http_proxy env variable.
I got round this by temporarily hacking in the --proxy
and --proxy-user flags and my values into the curl
call made by the pimp.py library - which worked
perfectly, but is obviously not a good or general
solution.
----
Note: If you need to hack this file it is:
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac/pimp.py
Search for "curl" and change the code there to
something like the following (replace uppercase stuff
as appropriate, also the lines with '+' are the lines
I added, don't include the '+')
if _cmd(output, self._db.preferences.downloadDir,
"curl",
+ "--proxy PROXYNAME:PROXYPORT",
+ "--proxy-user USERNAME:PASSWORD",
"--output", self.archiveFilename,
btw, it is not good to leave your password lying round
in these sorts of world readable library files :P
----
Anyway, I thought that the developers should be aware
that PackageManager (actually I guess urllib) and curl
conflict in this way - and perhaps my ugly work around
will prove usefully for somebody until this is
addressed?
Cheers,
Matt Duignan
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what youre looking for faster
http://search.yahoo.com
More information about the Pythonmac-SIG
mailing list