jamalex / notion-py

Unofficial Python API client for Notion.so
MIT License
4.3k stars 474 forks source link

Is there a way to get shared pages? #164

Open pratyakshs opened 4 years ago

pratyakshs commented 4 years ago

The Notion app has three main headings on the left side-panel: Workspace, Shared, and Private. I'm able to get all the pages in Workspace and Private by calling client.get_top_level_pages(). However, it does not return any pages that are under the Shared heading. Is there a way to fetch these?

TheSpeedM commented 4 years ago

I think this should do the trick:

space = client.get_space(SPACE_ID)

# Get the IDs of the pages in that space
pages = space.pages

I have no clue how to get the ID of a space though.

MrAnyx commented 9 months ago

I have no clue how to get the ID of a space though.

You can do so by opening the developer console. When you switch from a space to another, you'll get 3 messages about analyticsHelpers: forceOverrideMismatch.

The first one is about the page_id, the second one is about the spaceId (this is the one you want)and the third one is about the pageVisitedId

The spaceId that is displayed is the one you just leaved.