Nobody knows? But why?
A
printers at sendme.cz
Tue Jan 29 08:57:15 EST 2002
Hi,
For already some time I am trying to use
modules, HTTPLIB or URLLIB to get a page through proxy but so
far I have not been successfull
I also browsed Python group but the samples given there did not
work.
Can anybody give me a WORKING example how I can grab a web
page through proxy?
I tried this example
########################
#######################
import httplib
h = httplib.HTTP('209.242.141.249:8080') #proxy
h.putrequest('GET', 'http://www.autoplzen.info/index.php')
h.putheader('Accept', 'text/html')
h.putheader('Accept', 'text/plain')
#h.putrequest('Proxy-Connection', 'Keep-Alive') # it does not work,
#so I commented
#h.putrequest('Host', 'www.autoplzen.info') the same,otherwise I
#receive File "C:\PYTHON21\lib\httplib.py", line 430, in putrequest
# raise CannotSendRequest()
h.endheaders()
errcode, errmsg, headers = h.getreply()
print errcode # Should be 200
#######################################
The above example works as if there were no proxy because in
web server log there is not IP of Proxy but mine.
Any help would be appreciated.
thanks
Ladislav
------- End of forwarded message -------
More information about the Python-list
mailing list