Tam
Tam

Reputation: 104

403 error code Google Drive Python The download quota for this file has been exceeded

I used Google Drive Python library 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)

and received 403 error when download large file

{
 "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"
 }
}

It always happens after 53 request download regardless of chunk size.

I do not see any error in the handler error.

Upvotes: 5

Views: 6929

Answers (1)

Eric Koleda
Eric Koleda

Reputation: 12673

Update 2016-08-12: This issue should now be resolved.

This appears to be a bug in how we calculate download quota, since chunked downloads should only count as one download. The engineering team is aware of the problem, and if file an issue on our tracker I can update when we know more:

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

Upvotes: 2

Related Questions