2

我正在尝试使用 Google Drive python 客户端来选择所有具有 mimeType audio/mpeg OR audio/flac OR audio/ogg 的文件类型。这如何在单个查询中完成?我试过了:

files = drive.files().list().setQ("mimeType='audio/mpeg OR mimeType='audio/flac'").execute()

但是这个请求未能产生正确的结果。

4

1 回答 1

2

您在查询中丢失了一个单引号,并且查询无效:

mimeType='audio/mpeg' OR mimeType='audio/flac'
                    ^

但是 Google Drive API 仍然不支持or运算符,因此您必须执行两个查询才能获得所需的结果:

mpegs = drive.files().list().setQ("mimeType='audio/mpeg'").execute()
flacs = drive.files().list().setQ("mimeType='audio/flac'").execute()
于 2012-09-10T07:12:49.370 回答