Hi, I'm very new to GAE programming and I'm having problems trapping a
urlfetch error.
The urfetch section of code I'm using is this;
----------------------------------------------------------------------------------
import urllib
from google.appengine.api import urlfetch
from google.appengine.api.urlfetch import DownloadError
def submitInformation(url, parameters) :
encodedParams = dictionary2URI(parameters); # encode the
parameters
try:
result = urlfetch.fetch(url=url, payload=encodedParams,
method=urlfetch.POST, deadline=10, headers={'Content-Type':
'application/x-www-form-urlencoded'});
return(result.content);
except urlfetch.Error():
return("GAE_URL_RequestTimeout");
------------------------------------------------------------------------------------
This sends a request to my external server, which then does some
processing and returns a result which the rest of my script then
processes.
Sometimes the processing on my webserver can get delayed longer than
10 seconds and then my GAE app generates this;
---------------------------------------------------------------------------------
ApplicationError: 5
Traceback (most recent call last):
File "/base/python_runtime/python_lib/versions/1/google/appengine/
ext/webapp/__init__.py", line 511, in __call__
handler.get(*groups)
File "/base/data/home/apps/<appname>//4.342744288219235399/
online.py", line 222, in get
info = submitInformation(record.url,parameters);
File "/base/data/home/apps/<appname>/4.342744288219235399/
online.py", line 29, in submitInformation
result=urlfetch.fetch(url=url,payload=encodedParams,method=urlfetch.POST,headers={'Content-
Type': 'application/x-www-form-urlencoded'});
File "/base/python_runtime/python_lib/versions/1/google/appengine/
api/urlfetch.py", line 241, in fetch
return rpc.get_result()
File "/base/python_runtime/python_lib/versions/1/google/appengine/
api/apiproxy_stub_map.py", line 501, in get_result
return self.__get_result_hook(self)
File "/base/python_runtime/python_lib/versions/1/google/appengine/
api/urlfetch.py", line 331, in _get_fetch_result
raise DownloadError(str(err))
DownloadError: ApplicationError: 5
----------------------------------------------------------------------------------------
I thought the "except urlfetch.Error():" line should trap this
error, but it's not.
What am I doing wrong please?
Thanks
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.