Page
page ¶
Functionality around Notion pages.
Page(*args: Any, **kwargs: Any) ¶
A Notion page.
Attributes:
| Name | Type | Description |
|---|---|---|
props | PagePropertiesNS | accessor for all page properties |
comments: Discussion property ¶
Return the discussion thread of this page.
A page can only have a single discussion thread in contrast to inline comments.
Note
This functionality requires that your integration was granted read comment capabilities.
cover: ExternalFile | NotionFile | None property writable ¶
Cover of the page.
icon: NotionFile | ExternalFile | Emoji | CustomEmoji | None property writable ¶
Icon of the page, i.e. emojis, Notion's icons, or custom images.
in_db: bool property ¶
Return True if this page is located in a database.
is_locked: bool property ¶
Return whether the page is locked for editing.
is_page: bool property ¶
Return whether the object is a page.
parent_db: Database | None property ¶
If this page is located in a database return the database or None otherwise.
This is a convenience method to avoid the need to check and cast the type of the parent.
props: PagePropertiesNS instance-attribute ¶
public_url: str | None property ¶
Return the public URL of this database.
subdbs: list[Database] property ¶
Return all contained databases within this page
subpages: list[Page] property ¶
Return all contained pages within this page
title: Text | None property writable ¶
Title of the page.
url: str property ¶
Return the URL of this page.
__repr__() -> str ¶
__str__() -> str ¶
delete() -> Self ¶
Delete this page.
Warning
Deleting a page will also delete all child pages and child databases recursively. If these objects are already cached in the session, they will not be updated. Use session.cache.clear() to clear the cache or call reload() on them.
get_property(prop_name: str) -> Any ¶
Directly retrieve the property value from the API.
Use this method only if you want to retrieve a specific property value that might have been updated on the server side without reloading the whole page. In all other cases, use the props namespace of the page to avoid unnecessary API calls.
reload() -> Self ¶
Reload this page.
restore() -> Self ¶
Restore this page.
show(*, simple: bool | None = None) -> None ¶
Show the content of the page, rendered in JupyterLab
to_html(*, raw: bool = False) -> str ¶
Return the content of the page as HTML.
to_markdown() -> str ¶
Return the content of the page as Markdown.
Note
This will not include nested blocks, i.e. the children of top-level blocks.
wrap_obj_ref(obj_ref: obj_blocks.Page) -> Self classmethod ¶
PagePropertiesNS(page: Page, schema: type[Schema] | None) ¶
Namespace of the properties of a page as defined in the schema of the database.
This defines the .props namespace of a page page and updates the content on the Notion server side in case of an assignment. Access the properties with page.props.property_name or page.props['Property Name']. You can also convert it to a dictionary with dict(page.props).
__getattr__(attr_name: str) -> Any ¶
__getitem__(prop_name: str) -> Any ¶
__iter__() -> Iterator[str] ¶
Iterator of property names.
__len__() -> int ¶
Return the number of properties.
__repr__() -> str ¶
__setattr__(attr_name: str, value: Any) -> None ¶
__setitem__(prop_name: str, value: Any) -> None ¶
__str__() -> str ¶
is_db_guard(obj: NotionEntity | WorkspaceType | None) -> TypeIs[Database] ¶
Return whether the object is a database as type guard.
is_page_guard(obj: NotionEntity | WorkspaceType | None) -> TypeIs[Page] ¶
Return whether the object is a page as type guard.