On 4/2/06, Puneet Lakhina puneet.lakhina@gmail.com wrote:
im trying to test urllib.urlopen function in python 2.4
i do the following on the interpreter
import urllib
sock=urllib.urlopen("http://www.google.com ")
Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/local/lib/python2.4/urllib.py", line 77, in urlopen return opener.open(url) File "/usr/local/lib/python2.4/urllib.py", line 185, in open return getattr(self, name)(url) File "/usr/local/lib/python2.4/urllib.py", line 308, in open_http h.endheaders() File "/usr/local/lib/python2.4/httplib.py", line 795, in endheaders self._send_output() File "/usr/local/lib/python2.4/httplib.py", line 676, in _send_output self.send(msg) File "/usr/local/lib/python2.4/httplib.py", line 643, in send self.connect () File "/usr/local/lib/python2.4/httplib.py", line 611, in connect socket.SOCK_STREAM): IOError: [Errno socket error] (-2, 'Name or service not known')
i have configured the http proxy by exporting the http_proxy variable
export http_proxy=http://username:password@my.proxy.address:80
sorry.. should have RTFM... problem solved urllib does not support proxy authentication.. need to use urllib2
-- Puneet