-
Notifications
You must be signed in to change notification settings - Fork 474
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 all pages #43
Comments
I think there must be a better way to do this, but the following code works for me. The key starting point is def get_all_notion_pages():
def get_children(block):
result = []
for child in block.children:
if child.type == 'page':
result.append(child)
result += get_children(child)
return result
pages = []
for page_id in client.current_space.pages:
block = client.get_block(page_id)
if block.type == 'page':
pages.append(block)
pages += get_children(block)
return pages |
much appreciated! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there a way to pass a token and get all pages for a user?
most of the methods require you to pass a url to get the ID of the blocks and then interact with them but was wondering if there could be a higher function to get everything in a user workspace.
been trying to understand whats the real endpoint the api hits and from what i can see its something like notion.so/api/v3 but then what else is passed down to it? could that be something on the wiki page for people to test out things?
The text was updated successfully, but these errors were encountered: