【发布时间】:2020-03-04 04:43:16
【问题描述】:
我正在编写接口来使用谷歌驱动器和谷歌表格访问谷歌 api。对于每个 api,我像 google drive 一样按照google api 创建一个 credentials.json 并使用以下代码没有问题。但是作为接口,如何只用一个credentials.json文件访问多个api呢?
from googleapiclient.discovery import build
from oauth2client import client, tools
flow = client.flow_from_clientsecrets('~/credentials.json', ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive'])
creds = tools.run_flow(flow, store)
service = build('drive', 'v3', http=creds.authorize(Http()))
【问题讨论】:
标签: python-3.x google-api google-drive-api google-sheets-api google-api-python-client