Skip to content

Obj api

obj_api

Low-level object-oriented API for Notion.

This subpackage provides an object-oriented API for Notion by wrapping the JSON-structured requests and responses of notion-sdk-py into Python objects using pydantic. Also paginated result lists by the API are resolved automatically.

The code was taken originally from Notional by Jason Heddings and is MIT-licensed. Due to the Pydantic v2 migration and several other design changes, it was heavily refactored since then.

__all__ = ['NotionAPI', 'create_notion_client'] module-attribute

NotionAPI(client: NCClient)

Object-based Notion API (pydantic) with all endpoints.

blocks = BlocksEndpoint(self) instance-attribute

client = client instance-attribute

comments = CommentsEndpoint(self) instance-attribute

databases = DatabasesEndpoint(self) instance-attribute

pages = PagesEndpoint(self) instance-attribute

search = SearchEndpoint(self) instance-attribute

users = UsersEndpoint(self) instance-attribute

create_notion_client(cfg: Config, **kwargs: Any) -> notion_client.Client

Create a Notion client with the given authentication token.