我正在创建一个应用程序来使用Python备份存储在Google Drive中的文件。我遇到的第一个问题是,由于某种原因,它只能在每个文件夹中列出最多100个文件。我想我用正确的范围(“https://www.googleapis.com/auth/drive”),这里是我使用的代码行列出文件夹Google Drive API每个文件夹最多只能列出100个文件
folder_contents = service.files().list(q="'%s' in parents" % folder['id']).execute()
的内容有什么办法来改变上市文件数?我发现在这个线程Google Drive List API - not listed all the documents?,有一种方法可以做到这一点,但NumberToRetrieve
不起作用。我试图在Drive API参考网页(https://developers.google.com/drive/v2/reference/files/list)中测试它,但它给我一个错误。当我从我的代码中请求列表(我是使用Drive API的新的)时,我也无法弄清楚如何设置这个参数。
在此先感谢。
编辑:我找到了一种方法来增加使用MaxResuls
标志的文件数量。但它只允许列出多达1000个,这还不够。
直接链接到它如何完成:http://stackoverflow.com/questions/22092402/python-google-drive-api-list-the-entire-drive-file-tree – 2015-11-03 04:37:21