Google Places API: OVER_QUERY_LIMIT

左心房为你撑大大i 提交于 2019-12-13 09:14:31

问题


I am getting an error notifying me of exceeding the API Quota. However, I have a quota of 150,000 requests and have only used up 12,000 of them. What is causing this error?

example of code:

from googleplaces import GooglePlaces

api_key = ''
google_places = GooglePlaces(api_key)

query_result = google_places.nearby_search(location="Vancouver, Canada", keyword="Subway")
for place in query_result.places:
    print(place.name)

Error Message:

googleplaces.GooglePlacesError: Request to URL https://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=Vancouver%2C+Canada failed with response code: OVER_QUERY_LIMIT

回答1:


The request from error message is not a Places API request. This is Geocoding API request.

https://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=Vancouver%2C+Canada

It doesn't include any API key. That means you can have only 2500 daily geocoding requests without an API key. Also, geocoding requests have a query per second limits (QPS) which is 50 queries per second. You might be exceeding the QPS limit as well.

https://developers.google.com/maps/documentation/geocoding/usage-limits

Not sure why the library that supposed to be calling Places API web service in reality calls Geocoding API web service. Maybe this is some kind of fallback in case if Places API doesn't provide any result.



来源:https://stackoverflow.com/questions/45090694/google-places-api-over-query-limit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!