【发布时间】:2015-02-27 00:55:35
【问题描述】:
从服务器端设置调用自定义搜索 api 时,我间歇性地收到以下错误:
请求https://www.googleapis.com/customsearch/v1?q=John+Doe+john%40simpler.com&alt=json&cx=&key= 时的 HttpError 403 返回“您的 API 密钥上配置了 per-IP 或 per-Referer 限制,并且请求与这些限制不匹配。请使用 Google Developers Console 更新您的 API 密钥配置是否应允许来自此 IP 或引用者的请求。
我正在使用服务器 api 密钥,并已确认配置的服务器 ip 地址是正确的。大约 50% 的时间我的请求也能正常返回。我从服务器发出请求是这样的:
service = build("customsearch", "v1",
developerKey=api_key)
custom_search_context = <my_context>
res = service.cse().list(
q=search_query_string,
cx=custom_search_context,
).execute()
我每秒的请求数在 10/秒的配置限制和每天 5000 个请求的购买限制内。
我注意到的另一件事是,Google 也将被禁止的请求计入每日限制。
关于为什么我只是间歇性地出现错误的任何指示都会非常有帮助
【问题讨论】:
标签: google-api