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.3.tar.gz (12.6 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.3-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: notion_sdk_ldraney-0.2.3.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for notion_sdk_ldraney-0.2.3.tar.gz
Algorithm Hash digest
SHA256 5119db65359b4d545f707bd0148b649c8f0b4d42495f1b88d983ecbfd3f6fdf2
MD5 7679800ca04adeae7d0692ff43bd67ef
BLAKE2b-256 2ba34c6a86cf97facff080ad973b1ac3cfff5532399331509ee9d9357cdc2692

See more details on using hashes here.

Provenance

The following attestation bundles were made for notion_sdk_ldraney-0.2.3.tar.gz:

Publisher: publish.yml on ldraney/notion-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for notion_sdk_ldraney-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e55a840a06287682a2c25322afbdd8e2f5a0fea500706d4e69caf0905d6483e1
MD5 8d9d809c5a47c2c369bfc41526b5ba0d
BLAKE2b-256 7c2f4cb9e4a0df91739afa579304d6f5e24295048352b425c64b6668c523e08c

See more details on using hashes here.

Provenance

The following attestation bundles were made for notion_sdk_ldraney-0.2.3-py3-none-any.whl:

Publisher: publish.yml on ldraney/notion-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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