0.7
下面的代码在此处使用 Google 的 nodejs 客户端版本调用 Google Analytics Reporting API 。socket hang up
它会在某些执行时返回错误,但并非总是如此。这会是谷歌服务器端的错误吗?有没有简单的调试方法?顺便说一句,我连续打了几个电话,不确定是否是由速率限制引起的。
gapi = require "googleapis"
authClient = new gapi.auth.JWT(
config.ga.clientEmail,
config.ga.privateKeyPath,
null,
[config.ga.scopeUri]
)
authPromise = new Promise (resolve, reject) ->
authClient.authorize (err, token) ->
resolve token
return
return
authPromise.then ->
gapi.discover('analytics', 'v3')
.withAuthClient(authClient)
.execute (err, client) ->
...