不确定这是否与我的代码或谷歌方面的东西有关,但我可以将文件推送到驱动器,但由于某些原因,我不能列出文件夹内的文件/文件夹元数据。
SCOPES = ['https://www.googleapis.com/auth/drive']
SERVICE_ACCOUNT_FILE = 'creds.json'
credentials = service_account.Credentials.from_service_account_file(SERVICE_ACCOUNT_FILE, scopes=SCOPES)
service = build('drive', 'v3', credentials=credentials)
topFolderId = '0AAYXadsMHp8IUk9PVA'
items = []
pageToken = ""
while pageToken is not None:
response = service.files().list(q="'" + topFolderId + "' in parents", pageSize=1000, pageToken=pageToken, fields="nextPageToken, files(id, name)").execute()
items.extend(response.get('files', []))
pageToken = response.get('nextPageToken')
任何想法在这里,我不认为这是权限相关,因为我可以把文件在驱动器,只是没有列出它们。
1条答案
按热度按时间o8x7eapl1#
我想你忘了。execute()