Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotionValidationError: Invalid input when calling .get_rows() #353

Open
geraldtayyj opened this issue Oct 9, 2021 · 6 comments
Open

NotionValidationError: Invalid input when calling .get_rows() #353

geraldtayyj opened this issue Oct 9, 2021 · 6 comments

Comments

@geraldtayyj
Copy link

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 :/

@ymmu
Copy link

ymmu commented Oct 10, 2021

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 .. ??

@arturmesquitab
Copy link

Same to me. Smoke test fails at this part as well.

@wsykala
Copy link
Contributor

wsykala commented Oct 10, 2021

I did a quick fix that works for some views (#352).
Does it work for you @ymmu @penguinoob ?

@ymmu
Copy link

ymmu commented Oct 10, 2021

@wsykala Oh, it works for me as well when trying to get data from the table !
Thank you so much for fix ! ;))

@geraldtayyj
Copy link
Author

@wsykala works for me as well. Thank you!

@alexattia
Copy link

Works for me too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants