Google Drive API限制搜索查询参数

时间:2015-04-20 01:40:38

标签: search google-drive-api

我有很多子文件夹,这是我的搜索代码

"trashed = false 
AND ( ".$folderIds." ) 
AND mimeType != 'application/vnd.google-apps.folder'"

其中$ folderIds是子文件夹,例如:

0B_123dSaMpleFolderId1 in parents or 0B_123dSaMpleFolderId2 in parents and 300 more folders

我知道限制已在此处发布:What is the limit on Google Drive API usage?

但我想知道这个限制...这个参数在发送到谷歌驱动器api时需要多长时间

Limit on search query parameter

1 个答案:

答案 0 :(得分:0)

Google Drive API v3允许我在598个文件夹中进行搜索:

len(gdrive.search(
    f"mimeType!='application/vnd.google-apps.folder' and 
    ({build_folder_subquery(folders[0:598])})"
))

713

但不是599:

len(gdrive.search(
    f"mimeType!='application/vnd.google-apps.folder' and 
    ({build_folder_subquery(folders[0:599])})"
))
*** googleapiclient.errors.HttpError: <HttpError 400 when requesting https://www.googleapis.com/drive/v3/files returned "The query is too complex.">

我不知道“查询太复杂”错误是由查询中的运算符数量,查询中的字符数量或其他某种度量触发的。以上查询中的字符数为29949和29999。