403 错误代码 Google Drive Python 已超出此文件的下载配额

Tam*_*Tam 5 python google-drive-api

我使用 Google Drive Python 库https://developers.google.com/drive/v3/web/quickstart/python#step_1_turn_on_the_api_name

try:
    request = self.api.files().get_media(fileId=file_id)
    with open(target_path, 'wb') as local_fd:
        media_request = http.MediaIoBaseDownload(local_fd, request, chunksize=Constant.CHUNK_SIZE)
        done = False
        while not done:
            download_progress, done = media_request.next_chunk(num_retries=Constant.MAXRETRY_NUM)
            if download_progress:
                logger.debug('Sleep 5 Download Progress: %d%%' % int(download_progress.progress() * 100))
            sleep(5)
except Exception, exp:
    return self.__exp_handler(exp)
Run Code Online (Sandbox Code Playgroud)

下载大文件时收到 403 错误

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "quotaExceeded",
    "message": "The download quota for this file has been exceeded",
    "locationType": "other",
    "location": "quota.download"
   }
  ],
  "code": 403,
  "message": "The download quota for this file has been exceeded"
 }
}
Run Code Online (Sandbox Code Playgroud)

无论块大小如何,它总是在 53 请求下载之后发生。

我在处理程序错误中没有看到任何错误。

Eri*_*eda 2

2016-08-12 更新:此问题现已解决。

这似乎是我们计算下载配额的一个错误,因为分块下载只能算作一次下载。工程团队已经意识到这个问题,如果在我们的跟踪器上提出问题,我可以在了解更多信息后进行更新:

https://code.google.com/a/google.com/p/apps-api-issues/