"collection.get_rows()" doesn't work.
I created a table for a test and tried to choose row using "collection.get_rows()". But I saw an error like below. I couldn't understand this error. Please help. I work on JupyterNotebook with Mac(macOS High Sierra), and browser is google chrome.
import json
from notion.client import NotionClient
from notion.block import *
TOKEN_V2 = "TOKEN_V2"
WORKSPACE_URL = "WORKSPACE_URL"
BLOCK_URL = "BLOCK_URL"
client = NotionClient(token_v2=TOKEN_V2)
link = WORKSPACE_URL
page = client.get_block(link)
cv = client.get_collection_view(BLOCK_URL)
sample_text = "a"
permission_row_ = cv.collection.get_rows(search=sample_text)
---------------------------------------------------------------------------
HTTPError Traceback (most recent call last)
/var/folders/bk/kxtjncm13ss694ydsp7hqmcw0000gn/T/ipykernel_78495/1373521628.py in <module>
1 sample_text = "a"
----> 2 permission_row_ = cv.collection.get_rows(search=sample_text) #権限を与える行を選択 (ブロックの中で)
/usr/local/lib/python3.8/site-packages/notion/collection.py in get_rows(self, **kwargs)
237
238 def get_rows(self, **kwargs):
--> 239 return self.query(**kwargs)
240
241 def _convert_diff_to_changelist(self, difference, old_val, new_val):
/usr/local/lib/python3.8/site-packages/notion/collection.py in query(self, **kwargs)
234
235 def query(self, **kwargs):
--> 236 return CollectionQuery(self, self._get_a_collection_view(), **kwargs).execute()
237
238 def get_rows(self, **kwargs):
/usr/local/lib/python3.8/site-packages/notion/collection.py in execute(self)
408 return result_class(
409 self.collection,
--> 410 self._client.query_collection(
411 **kwargs
412 ),
/usr/local/lib/python3.8/site-packages/notion/client.py in query_collection(self, *args, **kwargs)
292
293 def query_collection(self, *args, **kwargs):
--> 294 return self._store.call_query_collection(*args, **kwargs)
295
296 def as_atomic_transaction(self):
/usr/local/lib/python3.8/site-packages/notion/store.py in call_query_collection(self, collection_id, collection_view_id, search, type, aggregate, aggregations, filter, sort, calendar_by, group_by, limit)
343 }
344
--> 345 response = self._client.post("queryCollection", data).json()
346
347 self.store_recordmap(response["recordMap"])
/usr/local/lib/python3.8/site-packages/notion/client.py in post(self, endpoint, data)
258 )
259 )
--> 260 raise HTTPError(
261 response.json().get(
262 "message", "There was an error (400) submitting the request."
HTTPError: Invalid input.

#352 might solve your issue
Thanks @wsykala for your fix. I believe that there is a 100 records limit in get_rows() now (i.e. it only returns 100 records). Is it possible to increase that. Thanks! Hesam
@hesamparsa The limit of 100 is the default value. However you can pass any other value by calling the function with the limit keyword argument. Alternatively you can get all the rows from the view if you set the value to -1.
An example:
client = NotionClient(token_v2=TOKEN)
cv = client.get_collection_view(VIEW_URL)
rows = cv.collection.get_rows(limit=-1) # This will return all rows from your view
Thanks @wsykala limit argument worked! I just passed the max -1 still returned 100. Thanks again!