httplib and Proxy

Chris Gray cpgray at library.uwaterloo.ca
Thu Nov 20 16:28:11 CET 2003


On Thu, 20 Nov 2003, Rolf Wester wrote:
> I want to fetch some web-pages via http. I know how to do this without a
> proxy server in between but unfortunately we can only access the
> internet via a proxy. I would be very appriciative if anybody could tell
> me how to do this.
>
> Thanks in advance
>
> Rolf Wester
>
> P.S.: I would not mind to use sockets directly

You can use httplib.  The the host and port for the HTTPConnection should
be the proxy server and the URL for the request should include the host
name.  For instance:

h1 = httplib.HTTPConnection("my.proxy.com", 80)
h1.request("GET", "http://www.python.org/doc/current/lib/lib.html")

Chris Gray

"Okey dokey.. free my mind. Right, no problem, free my mind, free my mind,
no problem, right... "  -The Matrix






More information about the Python-list mailing list