【发布时间】:2020-10-07 23:11:38
【问题描述】:
我正在尝试使用mediaItems().search() 方法,使用以下正文:
body = {
"pageToken": page_token if page_token != "" else "",
"pageSize": 100,
"filters": {
"contentFilter": {
"includedContentCategories": {"LANDSCAPES","CITYSCAPES"}
}
},
"includeArchiveMedia": include_archive
}
但问题是集合 {"LANDSCAPES","CITYSCAPES"} 实际上应该是一组枚举(如在 Java 枚举中),而不是我写的字符串。这是在 API 中指定的:(https://developers.google.com/photos/library/reference/rest/v1/albums)
ContentFilter - 此过滤器允许您根据内容类型返回媒体项目。
JSON 表示
{ "includedContentCategories": [ enum (ContentCategory) ], "excludedContentCategories": [ enum (ContentCategory) ] }
有没有合适的方法在 python 中解决这个问题?
【问题讨论】: