简体   繁体   中英

Google Maps API Error for max requests per day/second

I'm building out a class to work with the google maps geocode api. The documentation states that there is a daily (2500 free, 100,000 business) and per second (5 free, 10 business) request max. I've done lots of googling and looking at other posts on this and my question that I can't seem to answer is this:

For those who have implemented this to a point to where they use it or can test it, how do I tell if an OVER_QUERY_LIMIT error is related to the DAILY max or the PER SECOND max? How do I distinguish between the two? I can't seem to find the answer in the documentation.

Thanks.

You can't distinguish from the OVER_QUERY_LIMIT itself. You can test to determine whether it's the daily or per second max by waiting a period of time and trying again. This is what Google says to do in order to distinguish between the two types of errors.

Upon receiving a response with status code OVER_QUERY_LIMIT, your application should determine which usage limit has been exceeded. This can be done by pausing for 2 seconds and resending the same request. If status code is still OVER_QUERY_LIMIT, your application is sending too many requests per day. Otherwise, your application is sending too many requests per second.

Google advises to pause the script for two seconds and try it again. Based on the result of the resent query, your application can differ between the daily or the per seconds limit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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