geekPinkFlower
geekPinkFlower

Reputation: 13

Google Book API Error "429 Client Error: Too Many Requests for url"

I have a list of authors and I wanted to retrieve books information based on the name. However, I keep getting this error after a few successfully retrieved items.

429 Client Error: Too Many Requests for URL...

I have 20k quotes per day, and 100 per minute per user.

try:
    key= "**********************************"
    api = f'https://www.googleapis.com/books/v1/volumes?q={author}&key={key}'
    response = requests.get(api)
    response.raise_for_status()
    print(response)
except requests.RequestException as e: 
    raise sys.exit(e)

Upvotes: 0

Views: 2520

Answers (1)

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 116878

The HTTP 429 Too Many Requests response status code indicates that your application has sent too many requests in a given amount of time ("rate limiting").

The best course of action is to slow your application down and make fewer requests. This request is most likely retriable so I would put a sleep in your code to wait a bit and then try the same request again.

Upvotes: 1

Related Questions