简体   繁体   English

google drive API 超出用户速率限制

[英]User Rate Limit Exceeded with google drive API

I'm building a web application on top of the Google Drive API.我正在 Google Drive API 之上构建一个 Web 应用程序。 Basically, the web application displays photos and videos.基本上,Web 应用程序显示照片和视频。 The media is stored in a Google Drive folder: Once authenticated, the application makes requests to the Google Drive API to get an URL for the media and displays each one.媒体存储在 Google Drive 文件夹中:经过身份验证后,应用程序向 Google Drive API 发出请求以获取媒体的 URL 并显示每个 URL。 For the moment, I have only 16 images to display.目前,我只有 16 张图片可以显示。 These images are hard-written in the application (for the demo).这些图像是硬写在应用程序中的(用于演示)。

I have encountered an issue with my application accessing Google Drive API.我的应用程序访问 Google Drive API 时遇到问题。 Indeed, after multiple tries, I've got this error for random requests确实,经过多次尝试,我收到了随机请求的错误

User Rate Limit Exceeded.超出用户速率限制。 Rate of requests for user exceed configured project quota.用户请求率超过配置的项目配额。 You may consider re-evaluating expected per-user traffic to the API and adjust project quota limits accordingly.您可以考虑重新评估 API 的预期每用户流量并相应地调整项目配额限制。 You may monitor aggregate quota usage and adjust limits in the API Console: https://console.developers.google.com/apis/api/drive.googleapis.com/quotas?project=XXXXXXX "您可以在 API 控制台中监控总配额使用情况并调整限制: https : //console.developers.google.com/apis/api/drive.googleapis.com/quotas?project=XXXXXXX

So I looked the API console and saw nothing special, I don't exceed the rate limit according to me.所以我查看了API控制台并没有看到什么特别的,我没有超过我的速率限制。 Maybe I use wrong the google API, I don't know in fact...也许我用错了谷歌 API,事实上我不知道......

右边的栏是我最后一次尝试:32 个查询

I followed the Google Drive API documentation to check whether I did something wrong.我按照 Google Drive API 文档检查我是否做错了什么。 For each API request, the request contains the access token, so it should work correctly !对于每个 API 请求,请求都包含访问令牌,因此它应该可以正常工作!

A demonstration of the app is available: https://poc-drive-api.firebaseapp.com该应用程序的演示可用: https : //poc-drive-api.firebaseapp.com

The source code is also available: https://github.com/Mcdostone/poc-google-drive-api (file App.js)源代码也可用: https : //github.com/Mcdostone/poc-google-drive-api (文件 App.js)

I'm building a web application on top of the Google Drive API.我正在Google Drive API的基础上构建一个Web应用程序。 Basically, the web application displays photos and videos.基本上,Web应用程序显示照片和视频。 The media is stored in a Google Drive folder: Once authenticated, the application makes requests to the Google Drive API to get an URL for the media and displays each one.媒体存储在Google云端硬盘文件夹中:通过身份验证后,应用程序会向Google云端硬盘API发出请求,以获取媒体的网址并显示每个网址。 For the moment, I have only 16 images to display.目前,我只有16张图像要显示。 These images are hard-written in the application (for the demo).这些图像在应用程序中(用于演示)进行了手写。

I have encountered an issue with my application accessing Google Drive API.我的应用程序访问Google云端硬盘API时遇到问题。 Indeed, after multiple tries, I've got this error for random requests确实,经过多次尝试,对于随机请求,我遇到了此错误

User Rate Limit Exceeded.超出用户速率限制。 Rate of requests for user exceed configured project quota.用户请求率超过配置的项目配额。 You may consider re-evaluating expected per-user traffic to the API and adjust project quota limits accordingly.您可以考虑重新评估API的预期每用户流量,并相应地调整项目配额限制。 You may monitor aggregate quota usage and adjust limits in the API Console: https://console.developers.google.com/apis/api/drive.googleapis.com/quotas?project=XXXXXXX "您可以在API控制台中监控总配额使用情况并调整限制: https : //console.developers.google.com/apis/api/drive.googleapis.com/quotas?project=XXXXXXX

So I looked the API console and saw nothing special, I don't exceed the rate limit according to me.因此,我查看了API控制台,没有发现什么特别之处,我没有超出速率限制。 Maybe I use wrong the google API, I don't know in fact...也许我使用了错误的Google API,但实际上我不知道...

右边的栏是我的最后尝试:32个查询

I followed the Google Drive API documentation to check whether I did something wrong.我遵循了Google Drive API文档,以检查是否做错了什么。 For each API request, the request contains the access token, so it should work correctly !对于每个API请求,该请求都包含访问令牌,因此它应该可以正常工作!

A demonstration of the app is available: https://poc-drive-api.firebaseapp.com该应用程序的演示可用: https : //poc-drive-api.firebaseapp.com

The source code is also available: https://github.com/Mcdostone/poc-google-drive-api (file App.js)源代码也可用: https : //github.com/Mcdostone/poc-google-drive-api (文件App.js)

I'm building a web application on top of the Google Drive API.我正在Google Drive API的基础上构建一个Web应用程序。 Basically, the web application displays photos and videos.基本上,Web应用程序显示照片和视频。 The media is stored in a Google Drive folder: Once authenticated, the application makes requests to the Google Drive API to get an URL for the media and displays each one.媒体存储在Google云端硬盘文件夹中:通过身份验证后,应用程序会向Google云端硬盘API发出请求,以获取媒体的网址并显示每个网址。 For the moment, I have only 16 images to display.目前,我只有16张图像要显示。 These images are hard-written in the application (for the demo).这些图像在应用程序中(用于演示)进行了手写。

I have encountered an issue with my application accessing Google Drive API.我的应用程序访问Google云端硬盘API时遇到问题。 Indeed, after multiple tries, I've got this error for random requests确实,经过多次尝试,对于随机请求,我遇到了此错误

User Rate Limit Exceeded.超出用户速率限制。 Rate of requests for user exceed configured project quota.用户请求率超过配置的项目配额。 You may consider re-evaluating expected per-user traffic to the API and adjust project quota limits accordingly.您可以考虑重新评估API的预期每用户流量,并相应地调整项目配额限制。 You may monitor aggregate quota usage and adjust limits in the API Console: https://console.developers.google.com/apis/api/drive.googleapis.com/quotas?project=XXXXXXX "您可以在API控制台中监控总配额使用情况并调整限制: https : //console.developers.google.com/apis/api/drive.googleapis.com/quotas?project=XXXXXXX

So I looked the API console and saw nothing special, I don't exceed the rate limit according to me.因此,我查看了API控制台,没有发现什么特别之处,我没有超出速率限制。 Maybe I use wrong the google API, I don't know in fact...也许我使用了错误的Google API,但实际上我不知道...

右边的栏是我的最后尝试:32个查询

I followed the Google Drive API documentation to check whether I did something wrong.我遵循了Google Drive API文档,以检查是否做错了什么。 For each API request, the request contains the access token, so it should work correctly !对于每个API请求,该请求都包含访问令牌,因此它应该可以正常工作!

A demonstration of the app is available: https://poc-drive-api.firebaseapp.com该应用程序的演示可用: https : //poc-drive-api.firebaseapp.com

The source code is also available: https://github.com/Mcdostone/poc-google-drive-api (file App.js)源代码也可用: https : //github.com/Mcdostone/poc-google-drive-api (文件App.js)

I'm building a web application on top of the Google Drive API.我正在Google Drive API的基础上构建一个Web应用程序。 Basically, the web application displays photos and videos.基本上,Web应用程序显示照片和视频。 The media is stored in a Google Drive folder: Once authenticated, the application makes requests to the Google Drive API to get an URL for the media and displays each one.媒体存储在Google云端硬盘文件夹中:通过身份验证后,应用程序会向Google云端硬盘API发出请求,以获取媒体的网址并显示每个网址。 For the moment, I have only 16 images to display.目前,我只有16张图像要显示。 These images are hard-written in the application (for the demo).这些图像在应用程序中(用于演示)进行了手写。

I have encountered an issue with my application accessing Google Drive API.我的应用程序访问Google云端硬盘API时遇到问题。 Indeed, after multiple tries, I've got this error for random requests确实,经过多次尝试,对于随机请求,我遇到了此错误

User Rate Limit Exceeded.超出用户速率限制。 Rate of requests for user exceed configured project quota.用户请求率超过配置的项目配额。 You may consider re-evaluating expected per-user traffic to the API and adjust project quota limits accordingly.您可以考虑重新评估API的预期每用户流量,并相应地调整项目配额限制。 You may monitor aggregate quota usage and adjust limits in the API Console: https://console.developers.google.com/apis/api/drive.googleapis.com/quotas?project=XXXXXXX "您可以在API控制台中监控总配额使用情况并调整限制: https : //console.developers.google.com/apis/api/drive.googleapis.com/quotas?project=XXXXXXX

So I looked the API console and saw nothing special, I don't exceed the rate limit according to me.因此,我查看了API控制台,没有发现什么特别之处,我没有超出速率限制。 Maybe I use wrong the google API, I don't know in fact...也许我使用了错误的Google API,但实际上我不知道...

右边的栏是我的最后尝试:32个查询

I followed the Google Drive API documentation to check whether I did something wrong.我遵循了Google Drive API文档,以检查是否做错了什么。 For each API request, the request contains the access token, so it should work correctly !对于每个API请求,该请求都包含访问令牌,因此它应该可以正常工作!

A demonstration of the app is available: https://poc-drive-api.firebaseapp.com该应用程序的演示可用: https : //poc-drive-api.firebaseapp.com

The source code is also available: https://github.com/Mcdostone/poc-google-drive-api (file App.js)源代码也可用: https : //github.com/Mcdostone/poc-google-drive-api (文件App.js)

You can use this zero-dependency library I've created called rate-limited-queue , to limit the execution rate of tasks in a queue.您可以使用我创建的这个名为rate-limited-queue 的零依赖库来限制队列中任务的执行率。

Limiting 10 requests per second can be achieved like so:可以像这样实现每秒限制 10 个请求:

const createQueue = require("rate-limited-queue");

const queue = createQueue(
  1000 /* time based sliding window */,
  10 /* max concurrent tasks in the sliding window */);

const results = await queue([
  () => { /* a request code goes here */ },
  () => { /* another request code goes here */ }
  // ...
]);

You can download any particular file from google drive to your colab.. use您可以将任何特定文件从 google drive 下载到您的 colab .. 使用

!gdown https://drive.google.com/uc?id=14ikT5VererdfeOnQtIJREINKSDN !gdown https://drive.google.com/uc?id=14ikT5VererdfeOnQtIJREINKSDN

where the value post id, is what you'll get when you click on share link of the file in drive当您单击驱动器中文件的共享链接时,您将获得帖子 ID 值的位置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM