AccessTokenRefreshError:带有服务帐户的Gdata电子表格API

时间:2014-01-29 19:42:25

标签: google-oauth gdata google-spreadsheet-api google-api-python-client google-apps-marketplace

通过Google Apps Marketplace安装的应用的第一个背景,Using Service Accounts with GData Spreadsheet API

    credentials = SignedJwtAssertionCredentials(
                    SERVICE_ACCOUNT_EMAIL,
                    PRIVATE_KEY,
                    scope = SCOPE,
                    sub = "admin@domain.com")
    auth2token = gauth.OAuth2TokenFromCredentials(credentials)
    client = SpreadsheetsClient()
    auth2token.authorize(client)
    q = SpreadsheetQuery(title= "ItemMaster",title_exact=True,)
    feed = client.get_spreadsheets(query = q)

问题是API调用随机失败,

AccessTokenRefreshError: Invalid response 403.
Failed to retrieve access token: You are not authorized to perform this request.

我尝试进行一次测试,其中10个API调用一个接一个地进行,间隔1秒,至少有4个API调用因上述错误而失败。

我尝试检查API控制台上的配额并且没有超出限制,API的每个用户限制为Drive API的100个请求/用户/秒,并且已启用结算。

PS:此问题不同于Getting AccessTokenRefreshError: invalid_grant in Google API fro service accountGoogle API Python Client - AccessTokenRefreshErrorinvalid_grant相关的问题,而我的问题与API调用的随机失败具体相关

编辑:问题似乎与google-api-python-client中的#210有关

0 个答案:

没有答案