Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for user-provided Google Books API key to fix "429 Client Error: Too Many Requests" #3281

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

cjwin2000
Copy link

@cjwin2000 cjwin2000 commented Jan 11, 2025

Using the Google Books API without a key is limited to a hard cap of global daily requests. Once the quota is reached, all requests without a key return a 429 error. This can be worked around by using a free personal API key generated in the Google Cloud console. The key allows for 1000 requests a day, and users can request a limit increase for free from Google if that is not enough. API key can be added in Admin Panel -> Basic Settings -> Feature Configuration.

Functionality for users that do not wish to use a personal API key remains unchanged.

I don't see an open issue, but here is a discord user running into it. Here is the json response from that request when the quota is reached:

{
  "error": {
    "code": 429,
    "message": "Quota exceeded for quota metric 'Queries' and limit 'Queries per day' of service 'books.googleapis.com' for consumer 'project_number:624717413613'.",
    "errors": [
      {
        "message": "Quota exceeded for quota metric 'Queries' and limit 'Queries per day' of service 'books.googleapis.com' for consumer 'project_number:624717413613'.",
        "domain": "global",
        "reason": "rateLimitExceeded"
      }
    ],
    "status": "RESOURCE_EXHAUSTED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "RATE_LIMIT_EXCEEDED",
        "domain": "googleapis.com",
        "metadata": {
          "quota_location": "global",
          "quota_limit_value": "20000000",
          "consumer": "projects/624717413613",
          "quota_limit": "defaultPerDayPerProject",
          "service": "books.googleapis.com",
          "quota_metric": "books.googleapis.com/default"
        }
      },
      {
        "@type": "type.googleapis.com/google.rpc.Help",
        "links": [
          {
            "description": "Request a higher quota limit.",
            "url": "https://cloud.google.com/docs/quotas/help/request_increase"
          }
        ]
      }
    ]
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant