notion-client api
notion-sdk-py is a simple and easy to use client library for the official Notion API.
It is meant to be a Python version of the reference JavaScript SDK, so usage should be pretty similar between both.
Announcement (18-04-2022) Notion API is officially out of beta, and we are too: 1.0.0 is now released! Beware, Notion-Version has been upgraded to 2022-02-22 and it brings breaking changes.
Installation
pip install notion-client
Usage
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...