how to use a proxy?

Steven Adams adams_s at lab.eng.usyd.edu.au
Wed May 17 22:26:11 EDT 2000


to get it using httplib use something like

import httplib

PROXYHOST = 'proxy.mt.net.au'
PROXYPORT = 8080

url = 'http://www.someserver.somedomain/the_File_I_Want_To_Get.html'

h = httplib.HTTP(proxyhost, proxyport)
h.putrequest('GET', url)
h.putheader('Accept', 'text/html')
h.endheaders()

errcode, errmsg, headers = h.getreply()
print errcode # Should be 200

f = h.getfile()
data = f.read() # Get the raw HTML
f.close()



<moonseeker at my-deja.com> wrote in message
news:8fri52$25o$1 at nnrp1.deja.com...
> 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
> 11111111111111
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.





More information about the Python-list mailing list