UrlFetchApp超时 [英] UrlFetchApp timeout

查看:95
本文介绍了UrlFetchApp超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Google表格下载一些报告.

因此,基本上,我使用的是 UrlFetchApp 来完成这项工作,并且它在1分钟内收到响应时就执行了.如果响应时间超过一分钟,则请求将超时并且报告不会下载.

这是我通过 UrlFetchApp 发送的选项:

  var选项= {"method":"post","header":"someHeaders","muteHttpExceptions":是的,"followRedirects":否,"Content-Encoding":"gzip","payload":"somePayload"} 

,然后简单调用 .fetch().

有没有办法增加超时时间或其他解决方法?

解决方案

尽管未公开记录,但通过测试 UrlFetchApp [1]的提取函数有1分钟的超时时间,我意识到了这一点.有一个功能请求正在打开,以扩展或允许配置 UrlFetchApp 超时[2].

[1] https://developers.google.com/apps-script/reference/url-fetch/url-fetch-app

[2] https://issuetracker.google.com/issues/36761852

I'm trying to download some reports using Google Sheets.

So basically I'm using UrlFetchAppto do the job and it does when the response is received within 1 minute. If the response is taking more than a minute then the request times out and the reports are not downloaded.

This is the options that I'm sending with UrlFetchApp:

var options = {
  "method" : "post",
  "header" : "someHeaders",
  "muteHttpExceptions" : true,
  "followRedirects" : false,
  "Content-Encoding" : "gzip",
  "payload" : "somePayload"
}

and then a simple call of .fetch().

Is there a way to increase the timeout or any workaround for it?

解决方案

Although it's not publicly documented, I realized by testing that fetch functions for UrlFetchApp [1] have a 1 minute timeout. There's a Feature Request open to extend or allow to configure the UrlFetchApp timeout [2].

[1] https://developers.google.com/apps-script/reference/url-fetch/url-fetch-app

[2] https://issuetracker.google.com/issues/36761852

这篇关于UrlFetchApp超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆