Skip to main content

Python SDK for the Notion API v2025-09-03

Project description

PyPI License: MIT Python 3.10+

notion-sdk

Python SDK for the Notion API. Thin wrapper with 1:1 endpoint mapping, proven with pytest integration tests.

Why

The official Notion MCP integration silently drops properties on database creation/update. This SDK correctly uses initial_data_source.properties and is validated against the live API.

Install

pip install notion-sdk-ldraney

Usage

from notion_sdk import NotionClient

client = NotionClient(api_key="secret_...")

# Create a database with properties that actually work
db = client.create_database(
    parent={"type": "page_id", "page_id": "..."},
    title=[{"text": {"content": "My DB"}}],
    initial_data_source={
        "properties": {
            "Name": {"type": "title", "title": {}},
            "Status": {"type": "select", "select": {
                "options": [{"name": "Done", "color": "green"}]
            }}
        }
    }
)

API Coverage

  • Search: search
  • Pages: create (with template support), get, update (with erase_content), archive, move
  • Databases: create (with properties!), get, update, query, archive
  • Data Sources: get, update, query, list templates
  • Blocks: get, get children, append children, update, delete
  • Users: list, get self
  • Comments: create, list

Testing

# Set your Notion API key
export NOTION_API_KEY=secret_...

# Run integration tests
pytest tests/ -v

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

notion_sdk_ldraney-0.2.4.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

notion_sdk_ldraney-0.2.4-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file notion_sdk_ldraney-0.2.4.tar.gz.

File metadata

  • Download URL: notion_sdk_ldraney-0.2.4.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for notion_sdk_ldraney-0.2.4.tar.gz
Algorithm Hash digest
SHA256 7dd06b43b33b733676a74ecea3b051c7ecaf2d1c542939eb1b46cb3c7868640a
MD5 053ee845a5614bd4555873935f0bdd65
BLAKE2b-256 af8ae51b47ec211d38837c5a92ac405d23a8bd7803689a98214342581f75975c

See more details on using hashes here.

File details

Details for the file notion_sdk_ldraney-0.2.4-py3-none-any.whl.

File metadata

File hashes

Hashes for notion_sdk_ldraney-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 135d57a5f0f845ed15ea1388286479864c16a4b139b90cd271a7b6007c2f3564
MD5 166a33f7143b8c812a49b9491ee7129c
BLAKE2b-256 271b3b7950fab975eceed0ac1fa7feb5e3cb19a6fd95a48d1b8d1b586d83d69b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page