Getting web page throught a proxy (squid)

Steven Adams adams_s at
Wed Mar 22 03:22:29 CET 2000

Jean-Paul ROUMIAN wrote:
> Hello,
> I try to get a web page,from  behind a proxy (squid) which uses the ICP
> protocol.
> Is there a module that can do that (httplib can't as far as I know) ?
> (I need also  a ssl-connection, but I've found patches for this)
> Any pointers ?
> Jean-Paul ROUMIAN


I had to had to do exactly this, didn't need ssl though,
here's a quick script that gets a webpage via proxy, and prints it out
to screen (not too useful, but its only an example :-)

import httplib
PROXY = 'yourproxyname:yourproxyport' 

h = httplib.HTTP(PROXY)

errcode,errmsg,headers = h.getreply()
print errcode

file = h.getfile()
data =
print data


OK, so it ain't pretty, and it doesn't check that the errorcode is 200
before getting file.
but that was how I realised it was SQUID running as proxy.

hope that helps


More information about the Python-list mailing list