简体   繁体   English

Pydrive:如何从共享驱动器读取文件?

[英]Pydrive : How to read file from Shared Drive?

I successsed to have all my shared drive IDs but when I am trying to read these it returns me empty an list:我成功获得了所有共享驱动器 ID,但是当我尝试读取这些 ID 时,它会返回一个空列表:

for myfile in file_list:
    if myfile['id'] == 'file_id' and myfile['title'] == 'file_tittle' :
        file_list =  drive.ListFile({'q':"'file_id' in parents and trashed=false"}).GetList()
        for i in file_list:
            print(i)

You need to set the parameters supportsAllDrives and includeItemsFromAllDrives to true您需要将参数supportsAllDrivesincludeItemsFromAllDrivestrue

This is specified in the Parameters section for the method.这在方法的参数部分中指定。

Sample:样本:

file_list = drive.ListFile({
    'q': "'file_id' in parents and trashed=false",
    'supportsAllDrives': True,  
    'includeItemsFromAllDrives': True
}).GetList()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM