How to get web page through a proxy server?

Erno Kuusela erno-news at erno.iki.fi
Wed Jan 16 06:05:51 EST 2002


In article <89a7d11f.0201160215.29912c85 at posting.google.com>,
cto at lucifersoft.com (PythonFan) writes:

| How to get web page through a proxy server?

if you want to use httplib, you have to connect to the proxy server
and do a GET request for http://some.web.site/document/.

it may be easier to use urllib, since it can use a proxy transparently
(other than error reporting gets mungled, because the proxy will
return socket level errors as html documents).

to get urrlib to use a proxy, set the HTTP_PROXY environment variable.
(you can also specify it to the urllib.URLopener constructor.)

  -- erno



More information about the Python-list mailing list