我正在尝试使用 Google Drive python 客户端选择 mimeType 音频/mpeg 或音频/flac 或音频/ogg 的所有文件类型。如何在单个查询中完成此操作? 我尝试过:
files = drive.files().list().setQ("mimeType='audio/mpeg OR mimeType='audio/flac'").execute()
但是这个请求未能产生正确的结果。
最佳答案
您在查询中丢失了一个单引号,查询无效:
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()
关于python - Google Drive Api q 对象的 OR 过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12346113/