且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Google自定义搜索API返回未配置访问权限

更新时间:2023-02-16 17:53:38

(我在这里重复我给你的答案

(I'm repeating here the answer I gave you here).

不,我相信自定义搜索API是唯一需要启用的API.

No, I believe that custom search API is the only API that you need to enable.

因此,我将考虑您是否具有正确的密钥和CSE ID.

So, I would consider whether you have the right key and CSE ID.

要验证您的CSE ID,请从此处进行测试查询(填写): https://console.developers. google.com/project/PROJECT_ID/apiui/api/customsearch/method/search.cse.list

To verify your CSE ID, do a test query from here (fill in ): https://console.developers.google.com/project/PROJECT_ID/apiui/api/customsearch/method/search.cse.list

如果您的查询在此起作用,但仍无法在您的代码中起作用,那么问题可能出在您的钥匙上.如果您只是在执行一个简单的URL请求(如您在Q中所示),那么我希望您正在使用服务器密钥.而且,当然,您使用的密钥必须来自启用了CSE API的同一项目.

If your query works there, but still doesn't work in your code, then perhaps the issue is your key. If you are just doing a simple URL request (as you show in your Q), then I would expect you are using a server key. And, of course, the key you are using must be from the same project where you have enabled the CSE API.