Official Notion SDK rewritten in Python (sync + async)

notion-sdk-py

This client is meant to be a Python version of the reference JavaScript SDK,
so usage should be pretty similar between both. 😊

📢 Announcement (14-08-2021) — 0.6.0 is now released and adds support for
the recent Notion API changes.
Upgrading should be seamless from 0.4.0 onwards.

Installation

pip install notion-client

Usage

Before getting started, create an integration
and find the token.
→ Learn more about authorization.

Import and initialize a client using an integration token or an
OAuth access token.

import os
from notion_client import Client

notion = Client(auth=os.environ["NOTION_TOKEN"])

In an asyncio environment, use the asynchronous client instead:

from notion_client import AsyncClient

notion = AsyncClient(auth=os.environ["NOTION_TOKEN"])

Make a request to any Notion API endpoint.

See the complete list of endpoints in the API reference.

from pprint import pprint

list_users_response = notion.users.list()
pprint(list_users_response)

 

 

 

To finish reading, please visit source site