>From what I am reading in the Python Documentation....
(See Index, Proxy, Page 288)

You need to use URLLIB2, instead of Httplib, and set the
ProxyHandler method...

Httplib just does not have the intelligence to deal with proxies,
unless my docs have become outdated...

It's (httplib) is just the basic functions for accessing the URL's.
Urllib & Urllib2 are "extendors", which build upon the functionality
of the httplib.

                - Benjamin

-----Original Message-----
From: A [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 29, 2002 8:57 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: Nobody knows? But why?




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 -------
_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
To unsubscribe:
http://listserv.ActiveState.com/mailman/listinfo/activepython
_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/listinfo/activepython

Reply via email to