Getting web page throught a proxy (squid)
adams_s at lab.eng.usyd.edu.au
Wed Mar 22 03:22:29 CET 2000
Jean-Paul ROUMIAN wrote:
> I try to get a web page,from behind a proxy (squid) which uses the ICP
> 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 :-)
PROXY = 'yourproxyname:yourproxyport'
h = httplib.HTTP(PROXY)
errcode,errmsg,headers = h.getreply()
file = h.getfile()
data = file.read()
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