2
沒有其他類似名稱的問題已經解決了我的問題。HTTP錯誤400錯誤的請求(其他類似的問題沒有幫助我)
爲什麼我會收到此錯誤?我從google的github複製並粘貼了這個示例代碼。
import pprint
from googleapiclient.discovery import build
def main():
# Build a service object for interacting with the API. Visit
# the Google APIs Console <http://code.google.com/apis/console>
# to get an API key for your own application.
service = build("customsearch", "v1",
developerKey="AIzaSyDRRpR3GS1F1_jKNNM9HCNd2wJQyPG3oN0")
res = service.cse().list(
q='lectures',
cx='017576662512468239146:omuauf_lfve',
).execute()
pprint.pprint(res)
if __name__ == '__main__':
main()
Here is where I go the code from
我收到此錯誤:
Traceback (most recent call last):
File "testpython", line 17, in <module>
main()
File "testpython", line 12, in main
cx='017576662512468239146:omuauf_lfve',
File "/home/mddrill/.local/lib/python2.7/site-packages/oauth2client/util.py", line 137, in positional_wrapper
return wrapped(*args, **kwargs)
File "/home/mddrill/.local/lib/python2.7/site-packages/googleapiclient/http.py", line 838, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 400 when requesting https://www.googleapis.com/customsearch/v1?q=lectures&alt=json&cx=017576662512468239146%3Aomuauf_lfve&key=AIzaSyDRRpR3GS1F1_jKNNM9HCNd2wJQyPG3oN0 returned "Bad Request">
這真的是你的鑰匙嗎? –