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

get_collection_view() return error 400, unless it's favorited #299

Closed
teenphly opened this issue Mar 9, 2021 · 3 comments
Closed

get_collection_view() return error 400, unless it's favorited #299

teenphly opened this issue Mar 9, 2021 · 3 comments

Comments

@teenphly
Copy link

teenphly commented Mar 9, 2021

Hi, I'm new to python and notion-py, and just get started. Today, I tried:

from notion.client import NotionClient
token = <my token>
url = <url to my database>
client = NotionClient(token_v2=token)
cv = client.get_collection_view(url)

and it gave me:

  File "test.py", line 7, in <module>
    cv = client.get_collection_view(url)
  File "/home/theo/.local/lib/python3.6/site-packages/notion/client.py", line 217, in get_collection_view
    block_id, force_refresh=force_refresh
  File "/home/theo/.local/lib/python3.6/site-packages/notion/client.py", line 169, in get_block
    block = self.get_record_data("block", block_id, force_refresh=force_refresh)
  File "/home/theo/.local/lib/python3.6/site-packages/notion/client.py", line 162, in get_record_data
    return self._store.get(table, id, force_refresh=force_refresh)
  File "/home/theo/.local/lib/python3.6/site-packages/notion/store.py", line 184, in get
    self.call_load_page_chunk(id)
  File "/home/theo/.local/lib/python3.6/site-packages/notion/store.py", line 286, in call_load_page_chunk
    recordmap = self._client.post("loadPageChunk", data).json()["recordMap"]
  File "/home/theo/.local/lib/python3.6/site-packages/notion/client.py", line 262, in post
    "message", "There was an error (400) submitting the request."
requests.exceptions.HTTPError: Invalid input.

I can access any page by get_block() normally, and finally get the collection view, but that would be troublesome. And when I favorite the database, it works just fine, I can get the collection view directly! I wonder what I'm doing wrong.

@herberthamaral
Copy link

Looks like notion has changed its API. I used the get_collection_view method a few weeks ago with no issues. I executed the same code today and I got the Invalid input. error.

@RenanBomtempo
Copy link

Looks like notion has changed its API. I used the get_collection_view method a few weeks ago with no issues. I executed the same code today and I got the Invalid input. error.

I'm experiencing the exact same thing.

@teenphly
Copy link
Author

teenphly commented Mar 9, 2021

@herberthamaral @RenanBomtempo
#294 this works

@teenphly teenphly closed this as completed Mar 9, 2021
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

3 participants