how to use a proxy?

Graham Bleach itdcgb at its.hants.gov.uk
Tue May 16 11:57:59 EDT 2000


"Charlie Derr" <drivel_drool at bigfoot.com> wrote in message
news:LOBBJCAMDNLNCGCCHGEIEEJCEJAA.drivel_drool at bigfoot.com...
> you have to set an environment variable
>
> HTTPProxy=<address>

No, it is http_proxy

# this usually works
import os, urllib
os.environ["http_proxy"]="http://firewall.bad.com:9999"
urllib.urlretrieve('http://www.python.org/')
#

This should put a copy of said page into a temp file.

> i might not have the case right, i remember looking through the source of
> urllib and finally finding it

I'm not sure about the case - it might be case insensitive, I always use
lowercase. It might be that I'm using NT, which does not have case-sensitive
environment variables. Anyone?

> and you'd need another one for
>
> FTPProxy
>
> etc...

The convention is <protocol>_proxy

i.e. https_proxy

> hth,
> ~c
>
> ~
> ~ Hi!
> ~
> ~ How can I use a proxy (I'm behind a firewall) to get HTML pages
> ~ from the net?
> ~ I hade a look on HTTPlib and URLlib but there is no comment about
proxies.
> ~
> ~ Regards,
> ~ Mike
> ~

G





More information about the Python-list mailing list