Repository navigation
Pagination in Places Produces ApiError: INVALID_REQUEST (Rate-limit Problem?) #366
Description
Activity
- addedtriage meI really want to be triaged.I really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
on May 30, 2020 I haven't had a chance to look into this. Did you find anything else on this?
Having the same issue, and can confirm that
time.sleep(2)solves it, so it seems to be a rate-limiting issue.If I call the API twice with no page_token the request works correctly.
If I query multiple different "type" with no sleep I don't get any rate-limiting/error either.The problem is there even if you don't use a radius.
Reacted by Ivan Grijalva, eboth and Orelvis Lago VasalloReacted by Karim shoair, Yunusemre and Noor SaidHad the same problem, fixed it using
time.sleep(2)
The reason for this behavior is also mentioned in the documentationThere is a short delay between when a next_page_token is issued, and when it will become valid. Requesting the next page before it is available will return an INVALID_REQUEST response. Retrying the request with the same next_page_token will return the next page of results.
Reacted by Karim shoair, Rahul , Mićić Filip and Noor SaidThere is a short delay between when a next_page_token is issued, and when it will become valid. Requesting the next page before it is available will return an INVALID_REQUEST response. Retrying the request with the same next_page_token will return the next page of results.
@skumarlabs could you point me to where you found that? I just can't seem to find that in the docs now.
Any updates on this?
This should either be closed as working as designed (as it is according to the docs) or add in an automatic sleep timer with override option when using a next_page_token.
Or better yet update the library to use the Nearby Search (New) api endpoint which only returns 20 results.
Environment Details
API Used: Places
OS: Mac OS 10.15.4 (Catalina)
Python Version: 3.8
Library Version: 4.4.1
Other Info: Executed in PyCharm
Steps to Reproduce
Code that Produces Exception
Stack Trace
Extra
Adding time.sleep(2) resolves this error and the code executes
Working Code