notion-sdk-py icon indicating copy to clipboard operation
notion-sdk-py copied to clipboard

Error while running example "first_project"

Open mccorkle opened this issue 2 years ago • 5 comments

When running the first_project example -- I got the following errors when attempting to filter by name:

  • httpx.HTTPStatusError: Client error '400 Bad Request'
  • notion_client.errors.APIResponseError: body failed validation. Fix one: {it then went on to list all of the body.filter types I could have provided}

The error is somewhere around this line:

  • https://github.com/ramnes/notion-sdk-py/blob/0058b8db15cf021f3118a74fb371892afbb8b998/examples/first_project/script.py#L59

According to the documentation on developers.notion.com -- the filter object currently does not accept text as a type filter -- only rich_text:

  • https://developers.notion.com/reference/post-database-query-filter#the-filter-object

After changing the line to search with rich_text, I was able to see the expected results for my search-by-name in the inline database.

mccorkle avatar Feb 27 '23 03:02 mccorkle

Yep, most likely a change on their side. Thanks for raising the issue, do you want to work on it? PR are always welcome. :)

ramnes avatar Feb 27 '23 10:02 ramnes

@ramnes are you busy on other works? I also met this issue.

I am also very busy on other works, and it seems this is not a minor change. :(

Yunlong-He avatar Apr 19 '23 09:04 Yunlong-He

If you need this fixed quickly, I'd recommend you to investigate the issue, as it's not in my plans at the moment. Happy to help in getting a PR merged though.

ramnes avatar Apr 19 '23 09:04 ramnes

Also if @mccorkle is right, it's just a matter of replacing text by rich_text, as mentioned in the first comment. :)

ramnes avatar Apr 19 '23 09:04 ramnes

yes, I just replaced that field, but not sure whether ok for all cases.

Yunlong-He avatar Apr 19 '23 13:04 Yunlong-He

#232 should have fixed this :)

ramnes avatar Apr 02 '24 18:04 ramnes