如何发现googleapi的方法签名?

How to discover the method signature of a google api?

我想使用 python google api 客户端库来检索我的 google 幻灯片的数据。 python 代码在结果方面应该等同于此 REST API 调用。

GET https://slides.googleapis.com/v1/presentations/GXGXGXGXGXGXGXuf3LAMp0I89qfQYv6ffHRmI?key={YOUR_API_KEY}

所以在 frontend/javascript 这边,我使用选择器 API 来 return 我一个文件 ID。我可以使用文件 ID 将幻灯片下载为 pdf 文件

但是,当我尝试使用幻灯片时 api、

http = httplib2.Http()
http_auth = credentials.authorize(http)

slide_service = build('slides', 'v1', http=http_auth)
p = slide_service.presentations(fileId).get()
print p

我得到异常 TypeError: methodResource() takes exactly 1 argument (2 given)

我尝试使用文件 ID 作为 get 方法的参数,如下所示:

p = slide_service.presentations().get(fileId)

再次失败并出现此错误:TypeError: method() takes exactly 1 argument (2 given)

这些pythonAPI的函数组合基本没有文档。检索幻灯片数据的正确方法是什么?

基于API资源管理器,get方法接受一个参数presentationId

所以 python 代码应该是

p = slide_service.presentations().get(presentationId=fileId)

所有 Google API 的 pydoc 可在此处获得:

https://developers.google.com/api-client-library/python/apis/

例如,特定幻灯片位于此处:

https://developers.google.com/resources/api-libraries/documentation/slides/v1/python/latest/