* est <[EMAIL PROTECTED]> [2007-07-23 09:50:17]:
> A simple py script
>
> import urllib2
> req=urllib2.Request("http://www.google.com")
> req.set_proxy("127.0.0.1:1","http")
> print urllib2.urlopen(req).read()
>
Try to use the ProxyHandler of urllib2.
import urllib2
proxy_url = 'http://' + PROXY_USER + ':' + PROXY_PASSWORD + \ '@' + PROXY_IP +
':' + PROXY_PORT
proxy_support = urllib2.ProxyHandler({'http': proxy_url})
opener = urllib2.build_opener(proxy_support, urllib2.HTTPHandler)
urllib2.install_opener(opener)
print urllib2.urlopen(req).read()
> urllib2.URLError: <urlopen error (10054, 'Connection reset by peer')>
The error indicates a network issue. Please see the difference when you use
the ProxyHandler to try it.
--
O.R.Senthil Kumaran
http://uthcode.sarovar.org
--
http://mail.python.org/mailman/listinfo/python-list