我想使用Python的谷歌API客戶端庫來檢索我的谷歌幻燈片的數據。就結果而言,python代碼應與此REST API調用等效。如何發現谷歌API的方法簽名?
GET https://slides.googleapis.com/v1/presentations/GXGXGXGXGXGXGXuf3LAMp0I89qfQYv6ffHRmI?key={YOUR_API_KEY}
所以在前端/ JavaScript方面,我使用picker API向我返回一個文件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)
基本上沒有關於這些python API函數合成的文檔。什麼是檢索幻燈片數據的正確方法?
你所引用的鏈接是不是我問的問題 –
我敢肯定它是API。您正按照[此處](https://developers.google.com/api-client-library/python/start/get_started#build-the-service-object)所述使用'apiclient.discovery'? pydoc解釋了build()返回的對象,就像你的代碼片斷一樣。 –
我以爲'apiclient'是舊圖書館?我在某處閱讀推薦「googleapiclient.discovery」。 –