Open ChicagoDev opened 4 years ago
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.
Had the same problem, fixed it using time.sleep(2)
The reason for this behavior is also mentioned in the documentation
There 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.
There 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
1) Retrieve a list of places with a radius 2) submit a next page request with next_page_token
Code that Produces Exception
Stack Trace
Extra
Adding time.sleep(2) resolves this error and the code executes
Working Code