python - 如何获取 google 自定义搜索 api 的开发者 ID?

标签 python google-app-engine google-api google-custom-search

我有一个 GAE 应用程序,所以我选择:

  1. 公共(public)访问 API
  2. 浏览器(或者我应该选择服务器)
  3. *.mysite.appspot.com/*, *.googleapis.com/*, http://localhost:8080/*

我进行 API 调用:

 from lib.googleapiclient.discovery import build
 service = build("customsearch", "v1",developerKey="xxxx")

但我收到错误:

"There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed."

我该怎么办?

最佳答案

除了您确实应该按照 Alex 的指示使用 API 服务器 key 这一事实之外,错误消息还告诉您 API 请求来自未经授权的 IP/域,因为该 IP/域尚未在 API 上列入白名单 key 。

我将使用允许的任何 IP 设置新​​的服务器 key (未定义 IP/范围)。

关于python - 如何获取 google 自定义搜索 api 的开发者 ID?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29065504/

相关文章:

python - pydev 调试器不会在断点处停止

javascript - 使用服务帐户访问 Google 表格时未定义回调

node.js - Node : Google Drive API for listing all files using query

python - webapp2 路由失败

python - 如何在 Fabric 中创建自定义帮助菜单?

python - 预期的 LP_c_float 实例而不是列表

python - Pylint 为每个变量提示 'Undefined variable'

google-app-engine - Google Talk接收具有不同jid资源的消息

javascript - 在 Google+ 集成中添加图像

Python OpenCV - 文件旋转,但颜色值被覆盖