notion-py
notion-py copied to clipboard
NotionValidationError: Invalid input when calling .get_rows()
Recently I have been getting a notion.client.NotionValidationError: Invalid #input. error when trying to get_rows() from my collection view. Below is the code to illustrate:
from notion.client import NotionClient
from dotenv import load_dotenv
import os
load_dotenv()
client = NotionClient(token_v2=os.getenv("NOTION_V2_APIKEY"))
tasklist = client.get_collection_view(os.getenv("TASKLIST"))
for row in tasklist.collection.get_rows():
if (row.get_property("status") == "Done 🙌"):
print("Done")
However I get the following error:
File "C:\Users\User\app.py", line 27, in update
for row in cv.collection.get_rows():
File "C:\Python39\lib\site-packages\notion\block\collection\basic.py", line 163, in get_rows
return self.query(**kwargs)
File "C:\Python39\lib\site-packages\notion\block\collection\basic.py", line 151, in query
return CollectionQuery(self, self._get_a_collection_view(), **kwargs).execute()
File "C:\Python39\lib\site-packages\notion\block\collection\query.py", line 60, in execute
self._client._store.call_query_collection(
File "C:\Python39\lib\site-packages\notion\store.py", line 354, in call_query_collection
data = self._client.post("queryCollection", data).json()
File "C:\Python39\lib\site-packages\notion\client.py", line 716, in post
raise NotionValidationError(msg, extra=res_data)
notion.client.NotionValidationError: Invalid input.
What went wrong? This code was working a few days ago :/
Me too. I replaced my code with issue #294 but it doesn't work. Was something changed in req payload form of notion.so/api/v3/queryCollection .. ??
Same to me. Smoke test fails at this part as well.
I did a quick fix that works for some views (#352). Does it work for you @ymmu @penguinoob ?
@wsykala Oh, it works for me as well when trying to get data from the table ! Thank you so much for fix ! ;))
@wsykala works for me as well. Thank you!
Works for me too