使用Python调用Notion API按状态过滤失败问题排查
Notion API添加状态过滤后出现Body验证失败的解决方法
我在开发程序时,使用以下Python代码通过Notion API过滤数据库条目:
my_page = notion.databases.query( **{ "database_id": database_id, "filter": { "and": [ { "property": On_GCal_Notion_Name, "checkbox": { "equals": False } } , { "or": [ { "property": Date_Notion_Name, "date": { "equals": todayDate } }, { "property": Date_Notion_Name, "date": { "next_week": {} } }] }, { "property": "Status", "status": { "equals": "complete" } } ] }, } )
单独使用其他过滤条件时一切正常,但添加状态过滤后出现了如下验证错误:
body failed validation. Fix one: body.filter.and[2].title should be defined, instead was `undefined`. body.filter.and[2].rich_text should be defined, instead was `undefined`. body.filter.and[2].number should be defined, instead was `undefined`. body.filter.and[2].checkbox should be defined, instead was `undefined`. body.filter.and[2].select should be defined, instead was `undefined`. body.filter.and[2].multi_select should be defined, instead was `undefined`. body.filter.and[2].status should be defined, instead was `undefined`. body.filter.and[2].date should be defined, instead was `undefined`. body.filter.and[2].people should be defined, instead was `undefined`. body.filter.and[2].files should be defined, instead was `undefined`. body.filter.and[2].url should be defined, instead was `undefined`. body.filter.and[2].email should be defined, instead was `undefined`. body.filter.and[2].phone_number should be defined, instead was `undefined`. body.filter.and[2].relation should be defined, instead was `undefined`. body.filter.and[2].created_by should be defined, instead was `undefined`. body.filter.and[2].created_time should be defined, instead was `undefined`. body.filter.and[2].last_edited_by should be defined, instead was `undefined`. body.filter.and[2].last_edited_time should be defined, instead was `undefined`. body.filter.and[2].formula should be defined, instead was `undefined`. body.filter.and[2].unique_id should be defined, instead was `undefined`. body.filter.and[2].rollup should be defined, instead was `undefined`. body.filter.and[2].or should be defined, instead was `undefined`. body.filter.and[2].and should be defined, instead was `undefined`.
经过排查,问题出在notion_client模块版本上,将该模块从0.4.0版本升级到2.0.0版本后,验证错误消失,功能恢复正常。
内容的提问来源于stack exchange,提问作者Eddie
相关产品推荐
相关产品推荐

