views:

543

answers:

2

I'm trying to have Django (on top of GAE) fetch data from another web service. I'm often hit with error like this:

ApplicationError: 2 timed out Request

Method: GET

Request URL:http://localhost:8080/

Exception Type: DownloadError

Exception Value: ApplicationError: 2 timed out

Exception Location: /google_appengine/google/appengine/api/urlfetch.py in _get_fetch_result, line 325

It feels as if it will time out only after 12 seconds (I'm not sure, but it's really short).

Question: how can I set a longer timeout?

+3  A: 

You can set it using the deadline argument of the fetch function. However, the maximum urlfetch timeout on GAE is 10 seconds. From the docs:

You can set a deadline for a request, the most amount of time the service will wait for a response. By default, the deadline for a fetch is 5 seconds. The maximum deadline is 10 seconds.

Mark B
A: 

It seems short but you have to know that the timeout of a request on GAE is around 30 seconds. As you probably need to do some operations on the response of your urlfetch, there's no need to have a timeout more than 10 seconds I think.

Jeremy