Nest Thermostat 的速率限制错误 - 响应代码 429

Rate Limit Error to Nest Thermostat - Response Code 429

我使用在 Github 上找到的非常酷的 Google 脚本(来源:https://gist.github.com/beezly/9b2de3749d687fdbff3f)获取我的 Nest 恒温器上的温度并将其记录到 Google 电子表格。

当我手动 运行 脚本时效果很好,但当我使用时间触发器自动 运行 时效果不佳。

将凭据发布到 API 时:

第 12 行:var response = JSON.parse(UrlFetchApp.fetch('https://home.nest.com/user/login', options).getContentText());

引发的异常是:

Request failed for https://home.nest.com/user/login returned code 429. Truncated server response: Too many requests (use muteHttpExceptions option to examine full response) (line 12, file "Code")

我怀疑不是我一个人在用这个脚本,触发器使用的Google源IP已经超过了Nest的限制API。

你有什么解决办法吗?我考虑过使用代理服务器,但UrlFetchApp.fetch功能似乎不接受它。

谢谢,

PF

我在开发过程中测试同一个脚本时只 运行 进入 "Too many requests" 错误。我能够让这个功能达到 运行 hourly 没问题,甚至每 5 分钟一次。

要按预期在触发器上获取此脚本 运行,只需将 getData() 切换为 doGet(),将其发布为具有匿名访问权限的 Web 应用程序,然后创建另一个函数(我将其称为 getData( )) 向您发布的 Web 应用程序发出请求 url(调用 doGet()),然后只需创建基于时间的触发器以 运行 新的 getData()。

这是我的版本https://gist.github.com/jbutters/bece2fffe85080fe4314