CONNECTION TIMED OUT ERROR using urllib2

rishi pathak mailmaverick666 at gmail.com
Fri Dec 5 02:17:05 EST 2008


Before executing script do
export http_proxy=http://<your proxy server address>:<port>/


On Fri, Dec 5, 2008 at 12:06 PM, svalbard colaco
<svalbardcolaco at gmail.com>wrote:

> Hi rishi,
>
> Thanks for ur reply,
> yes i set the following enviroment variables (FC6 platform)
> http_proxy,http_user,http_password
>
> But i get the same error; Can u tell me which other  variables i need to
> set or am i going wrong in the syntax of these
> variables?
>
> Regards
> sv
>
>
> On Fri, Dec 5, 2008 at 11:57 AM, rishi pathak <mailmaverick666 at gmail.com>wrote:
>
>> Are you sitting behind a proxy. If so then you have to set proxy for http
>>
>> On Fri, Dec 5, 2008 at 11:47 AM, svalbard colaco <
>> svalbardcolaco at gmail.com> wrote:
>>
>>> Hi all
>>>
>>> I have written a small code snippet to open a URL using urllib2 to open a
>>> web page , my python version is 2.4 but i get an urlopen error called
>>> connection timed out
>>>
>>> The following is the code snippet
>>>
>>> *import urllib2
>>>
>>> f = urllib2.urlopen('http://www.google.com/')
>>> print f.read(100)*
>>>
>>>
>>> where as the same url http://www.google.com/ works through my browser.
>>>
>>> The following is the back trace :
>>>
>>> File "test_url.py", line 3, in ?
>>>     f = urllib2.urlopen('http://www.google.com/')
>>>   File "/usr/lib/python2.4/urllib2.py", line 130, in urlopen
>>>     return _opener.open(url, data)
>>>   File "/usr/lib/python2.4/urllib2.py", line 358, in open
>>>     response = self._open(req, data)
>>>   File "/usr/lib/python2.4/urllib2.py", line 376, in _open
>>>     '_open', req)
>>>   File "/usr/lib/python2.4/urllib2.py", line 337, in _call_chain
>>>     result = func(*args)
>>>   File "/usr/lib/python2.4/urllib2.py", line 1021, in http_open
>>>     return self.do_open(httplib.HTTPConnection, req)
>>>   File "/usr/lib/python2.4/urllib2.py", line 996, in do_open
>>>     raise URLError(err)
>>> *urllib2.URLError: <urlopen error (110, 'Connection timed out*')>
>>>
>>>
>>> Any pointers in this regard will be of great help.
>>>
>>> Thanking you'll in advance.
>>>
>>> Regards,
>>> sv
>>>
>>>
>>>
>>> --
>>> http://mail.python.org/mailman/listinfo/python-list
>>>
>>>
>>
>>
>> --
>> Regards--
>> Rishi Pathak
>> Pune-Maharastra
>>
>
>


-- 
Regards--
Rishi Pathak
Pune-Maharastra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20081205/c496badc/attachment-0001.html>


More information about the Python-list mailing list