Google Places API。超过查询限制[英] Google Places API: OVER_QUERY_LIMIT

本文是小编为大家收集整理的关于Google Places API。超过查询限制的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我遇到了一个错误,通知我超出了API配额.但是,我有150,000个请求的配额,只用完了12,000个.是什么导致此错误?

代码的示例:

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)

错误消息:

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

推荐答案

错误消息的请求不是位置API请求.这是地理编码API请求.

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

它不包含任何API键.这意味着您只能在没有API键的情况下每天有2500个地理编码请求.同样,地理编码请求具有每秒限制的查询(QP),每秒50个查询.您可能也超出了QPS限制.

/用法限制

不确定为什么应该调用的库将API Web服务在现实中呼叫地理编码API Web服务.如果位置API不提供任何结果,也许这是某种后备.

其他推荐答案

对于任何在最近的时间内看这篇文章的人,Google做到了这一点,因此有必要拥有一个API键来使用其MAPS API.因此,请确保您的程序有一个API密钥.还要记住不同的节气门极限.

有关更多信息,请参见下文:

https://devervepers.google.com/maps/documentation/geocoding/geocoding/usage-andage-and-billing#: text = text = while%20there%20there%20the%20IS%20IS%20NO%20Maximim,,,侧%20和%20server%2DSIDE%20 Queries .

本文地址:https://www.itbaoku.cn/post/1937811.html

问题描述

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

推荐答案

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.

其他推荐答案

For anyone looking at this post in a more recent time period, Google has made it so it is NECESSARY to have an api key to use their maps api. So please ensure you have an api key for your program. Also keep in mind the different throttle limits.

See below for more info:

https://developers.google.com/maps/documentation/geocoding/usage-and-billing#:~:text=While%20there%20is%20no%20maximum,side%20and%20server%2Dside%20queries.