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

时间:2016-04-15 00:34:00

标签: python google-drive-api

我使用了Google云端硬盘库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)

并在下载大文件时收到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"
 }
}

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

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

1 个答案:

答案 0 :(得分:2)

更新2016-08-12 :现在应该解决此问题。

这似乎是我们计算下载配额的一个错误,因为分块下载应该只计为一次下载。工程团队意识到了这个问题,如果我们的跟踪器上存在问题,我可以在知道更多时更新:

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

相关问题