arturtamborski/notion-py

“Invalid Input” error calling a collection.

Opened this issue · 1 comments

Python 3.10.1 (main, Dec 6 2021, 22:18:13) [Clang 13.0.0 (clang-1300.0.29.3)]
IPython 8.0.1 -- An enhanced Interactive Python. Type '?' for help.

In [9]: page = client.get_collection(
   ...:     "https://www.notion.so/stblr/0e8906b81ce24b8b9c9f10b6081aff32?v=5333
   ...: 131ec3f6453ea1690d2fd8c7e04d"
   ...: )
---------------------------------------------------------------------------
NotionValidationError                     Traceback (most recent call last)
Input In [9], in <module>
----> 1 page = client.get_collection(
      2     "https://www.notion.so/stblr/0e8906b81ce24b8b9c9f10b6081aff32?v=5333131ec3f6453ea1690d2fd8c7e04d"
      3 )

File /opt/homebrew/Cellar/ipython/8.0.1/libexec/lib/python3.10/site-packages/notion/client.py:376, in NotionClient.get_collection(self, collection_id, force_refresh)
    353 def get_collection(
    354     self, collection_id: str, force_refresh: bool = False
    355 ) -> Optional[CollectionBlock]:
    356     """
    357     Retrieve an instance of Collection that maps to
    358     the collection identified by the ID passed in.
   (...)
    374         Found collection or None.
    375     """
--> 376     record_data = self.get_record_data(
    377         "collection", collection_id, force_refresh=force_refresh
    378     )
    380     if record_data:
    381         return CollectionBlock(self, collection_id)

File /opt/homebrew/Cellar/ipython/8.0.1/libexec/lib/python3.10/site-packages/notion/client.py:312, in NotionClient.get_record_data(self, table, url_or_id, force_refresh)
    287 def get_record_data(
    288     self, table: str, url_or_id: str, force_refresh: bool = False
    289 ) -> dict:
    290     """
    291     Get record data.
    292 
   (...)
    310         Record data.
    311     """
--> 312     return self._store.get(
    313         table=table, url_or_id=url_or_id, force_refresh=force_refresh
    314     )

File /opt/homebrew/Cellar/ipython/8.0.1/libexec/lib/python3.10/site-packages/notion/store.py:168, in RecordStore.get(self, table, url_or_id, force_refresh)
    166         self.call_load_page_chunk(rid)
    167     else:
--> 168         self.call_get_record_values(**{table: rid})
    169     result = self._get(table, rid)
    170 return result if result is not Missing else None

File /opt/homebrew/Cellar/ipython/8.0.1/libexec/lib/python3.10/site-packages/notion/store.py:262, in RecordStore.call_get_record_values(self, **kwargs)
    260 logger.debug(f"Calling 'getRecordValues' endpoint for requests: {requests}")
    261 data = {"requests": requests}
--> 262 data = self._client.post("getRecordValues", data).json()
    263 results = data["results"]
    265 for request, result in zip(requests, results):

File /opt/homebrew/Cellar/ipython/8.0.1/libexec/lib/python3.10/site-packages/notion/client.py:716, in NotionClient.post(self, endpoint, data, **kwargs)
    713 msg = res_data.get("message") or "<message was not provided>"
    715 if code == 400:
--> 716     raise NotionValidationError(msg, extra=res_data)
    718 if code == 401:
    719     raise NotionUnauthorizedError(msg, extra=res_data)

NotionValidationError: Invalid input.

I've also got this error...