【发布时间】:2016-10-04 16:32:42
【问题描述】:
我有一个任务处理程序正在向 Google 日历 API 发出批处理请求。 5 秒后,请求失败并显示 DeadlineExceededError:API 调用 urlfetch.Fetch() 响应时间过长并被取消。我已按照建议在我发出批处理请求的位置附近更改了 urlfetch.set_default_fetch_deadline(60) here 但似乎没有什么区别:截止日期似乎仍然是 5 秒。
我正在使用位于 oauth2client 和 httplib2 之上的 Python Google API 客户端库。但我的理解是,GAE 会拦截使用 urlfetch.Fetch 的底层调用。这也是堆栈跟踪似乎显示的内容。
您能看出urlfetch.set_default_fetch_deadline 似乎不起作用的任何原因吗?
编辑:
这是用于构建批处理请求的代码:
# note `http` is a oauth2client authorized http client
cal = apiclient.discovery.build('calendar','v3',http=http)
req = cal.new_batch_http_request(callback=_callback)
for event in events: # anything larger than ~5 events in batch takes >5 secs
req.add(
cal.events().patch(calendarId=calid, eventId=event["id"], body=self._value)
)
urlfetch.set_default_fetch_deadline(60) # has no effect
req.execute()
【问题讨论】:
标签: python google-app-engine google-api google-calendar-api task-queue