Skip to main content

Notion API Database Python Implementation

Reason this release was yanked:

Stable version 1.0.0 has been released. Install that version only if migration is not possible.

Project description

Python Notion Database

Notion API Database Python Implementation

created only by database from the official Notion API.

Installing / Getting started

pip install notion-database
import os
import pprint

from notion_database.page import Page
from notion_database.properties import Properties, Children

try:
    from dotenv import load_dotenv

    load_dotenv()
except ModuleNotFoundError:
    pass

NOTION_KEY = os.getenv('NOTION_KEY')
NOTION_DATABASE_ID = os.getenv('NOTION_DATABASE_ID')

PROPERTY = Properties()
PROPERTIES = {
    "name": PROPERTY.set_title("title"),
    "description": PROPERTY.set_rich_text("description"),
    "number": PROPERTY.set_number(1),
    "select": PROPERTY.set_select("test1"),
    "multi_select": PROPERTY.set_multi_select(["test1", "test2"]),
    "checkbox": PROPERTY.set_checkbox(True),
    "url": PROPERTY.set_url("www.google.com"),
    "email": PROPERTY.set_email("test@test.com"),
    "phone": PROPERTY.set_phone_number("010-0000-0000"),
}

PAGE = Page(integrations_token=NOTION_KEY, database_id=NOTION_DATABASE_ID)
PAGE.create_page(properties=PROPERTIES, children=[Children().set_body("hello world!")])
pprint.pprint(PAGE.result)

Building / Developing

python setup.py install

Features

  • Create Page object (the database item)

Todo

  • update Page object

  • Retrieve Page object

  • Retrieve database

  • query database

  • list database

Contributing

If you'd like to contribute, please fork the repository and use a feature branch. Pull requests are warmly welcome.

Links

Licensing

The code in this project is licensed under GPL license.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

notion-database-20210513.2.tar.gz (15.7 kB view hashes)

Uploaded Source

Built Distribution

notion_database-20210513.2-py3-none-any.whl (16.6 kB view hashes)

Uploaded Python 3

Supported by

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