the error is
URLError: <urlopen error timed out>

increase  the timeout here to 300:

responsemerops = opener.open('http://www.uniprot.org/mapping/', data,
timeout=30)

and see what happens


2013/12/7 sonu kumar <[email protected]>

> here is my Traceback...
>
> Traceback (most recent call last):
>   File "/opt/web-apps/web2py/gluon/restricted.py", line 217, in restricted
>     exec ccode in environment
>   File 
> "/opt/web-apps/web2py/applications/CleavPredict/controllers/default.py", line 
> 1541, in <module>
>   File "/opt/web-apps/web2py/gluon/globals.py", line 372, in <lambda>
>     self._caller = lambda f: f()
>   File 
> "/opt/web-apps/web2py/applications/CleavPredict/controllers/default.py", line 
> 557, in result
>     return uniprot_merops()
>   File 
> "/opt/web-apps/web2py/applications/CleavPredict/controllers/default.py", line 
> 315, in uniprot_merops
>     responsemerops = opener.open('http://www.uniprot.org/mapping/', data, 
> timeout=30)
>   File "/usr/lib64/python2.6/urllib2.py", line 397, in open
>     response = meth(req, response)
>   File "/usr/lib64/python2.6/urllib2.py", line 510, in http_response
>     'http', request, response, code, msg, hdrs)
>   File "/usr/lib64/python2.6/urllib2.py", line 429, in error
>     result = self._call_chain(*args)
>   File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
>     result = func(*args)
>   File "/usr/lib64/python2.6/urllib2.py", line 616, in http_error_302
>     return self.parent.open(new, timeout=req.timeout)
>   File "/usr/lib64/python2.6/urllib2.py", line 391, in open
>     response = self._open(req, data)
>   File "/usr/lib64/python2.6/urllib2.py", line 409, in _open
>     '_open', req)
>   File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
>     result = func(*args)
>   File "/usr/lib64/python2.6/urllib2.py", line 1190, in http_open
>     return self.do_open(httplib.HTTPConnection, req)
>   File "/usr/lib64/python2.6/urllib2.py", line 1165, in do_open
>     raise URLError(err)
> URLError: <urlopen error timed out>
>
>
> On Thursday, 5 December 2013 16:34:29 UTC-8, sonu kumar wrote:
>
>> Hi All,
>>
>> In my application I am trying to call external weblink to map data but it
>> always gives me <class 'urllib2.URLError'> <urlopen error timed out>
>> error.
>>
>> I am using several times urllib for calling same weblinks for different
>> mapping....Will this cause problem???
>>
>> params = {'from':'ID', 'to':'MEROPS_ID', 'format':'tab', 'query':'P22894'}
>>      data = urllib.urlencode(params)
>>      request1 = urllib2.Request('http://www.uniprot.org/mapping/', data)
>>      response = urllib2.urlopen(request1, timeout=30)
>>
>> params3 = {'from':'ID', 'to':'P_ENTREZGENEID', 'format':'tab',
>> 'query':'P22894'}
>>      coexdata = urllib.urlencode(params3)
>>      coexrequest = urllib2.Request('http://www.uniprot.org/mapping/',
>> coexdata)
>>      coexresponse = urllib2.urlopen(coexrequest, timeout=30)
>>
>> params4 = {'from':'ID', 'to':'P_ENTREZGENEID', 'format':'tab', 'query':
>> 'P22894'}
>>      data6 = urllib.urlencode(params4)
>>      requestmmpn = urllib2.Request('http://www.uniprot.org/mapping/',
>> data6)
>>      responsemmpn = urllib2.urlopen(requestmmpn, timeout=30)
>>
>>
>> I have seen one http_error_302
>>
>> 611.
>> 612.
>> 613.
>> 614.
>> 615.
>> 616.
>>
>> 617.
>> 618.
>> 619.
>> 620.
>>
>>         # Don't close the fp until we are sure that we won't use it
>>         # with HTTPError.
>>         fp.read()
>>         fp.close()
>>
>>         return self.parent.open(new, timeout=req.timeout)
>>
>>
>>     http_error_301 = http_error_303 = http_error_307 = http_error_302
>>
>>     inf_msg = "The HTTP server returned a redirect error that would " \
>>
>>
>> any suggestion to solve this issue
>>
>> Thanks
>>
>>
>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to