I looked for a way to set the deadline parameter in a more global way, but I couldn't fine one by mere inspection of the code. I came up with the following HACK in order to work around this problem:
# HACK: Monkeypatch google.appengine.api.urlfetch.fetch to increase the
# deadline. This is used by the various client libraries.
def _fetch(*args, **kargs):
from google.appengine.api.urlfetch import _orig_fetch # Import late.
kargs["deadline"] = 10
return _orig_fetch(*args, **kargs)
_fetch.this_is_the_wrapper = True
# HACK: Because of the way the dev app server works when reloading code,
# things are a little tricky here.
from google.appengine.api import urlfetch
if not hasattr(urlfetch.fetch, "this_is_the_wrapper"):
urlfetch._orig_fetch = urlfetch.fetch
urlfetch.fetch = _fetch
assert hasattr(urlfetch, "_orig_fetch")