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.

What's new

Installing / Getting started

pip install notion-database

List Database

from notion_database.database import Database

D = Database(integrations_token=NOTION_KEY)
D.list_databases(page_size=100)

Retrieve Database

from notion_database.database import Database

D = Database(integrations_token=NOTION_KEY)
D.retrieve_database(database_id=database_id)

Properties

from notion_database.properties import Properties

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

Children

from notion_database.properties import Children

children = Children()
children.set_body("hello world!")

Create Page

from notion_database.page import Page

P = Page(integrations_token=NOTION_KEY)
P.create_page(database_id=database_id, properties=PROPERTY, children=children)
page_id = P.result["id"]

Retrieve Page

from notion_database.page import Page

P = Page(integrations_token=NOTION_KEY)
P.retrieve_page(page_id=page_id)

Update Page

from notion_database.page import Page

P = Page(integrations_token=NOTION_KEY)
P.update_page(page_id=page_id, properties=PROPERTY)

Clear Properties

from notion_database.properties import Properties

PROPERTY = Properties()
PROPERTY.clear()

Archive Page

from notion_database.page import Page

P = Page(integrations_token=NOTION_KEY)
P.archive_page(page_id=page_id, archived=True)

Create database

from notion_database.database import Database

D = Database(integrations_token=NOTION_KEY)
D.create_database(page_id=page_id, title="TEST TITLE", properties=PROPERTY)

Building / Developing

python setup.py install

Features

  • list database

  • Retrieve database

  • Create database

  • Create Page object (the database item)

  • update Page object

  • Retrieve Page object

  • Archive Page

Todo

  • query 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.6.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

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

notion_database-20210513.6-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file notion-database-20210513.6.tar.gz.

File metadata

  • Download URL: notion-database-20210513.6.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.2

File hashes

Hashes for notion-database-20210513.6.tar.gz
Algorithm Hash digest
SHA256 cfea8c19927482f1da3e91cabea6ee83d355796f42a7f5d887c36020a7621ecc
MD5 74eabdc687a1896c5f956b446f38e56b
BLAKE2b-256 fe661c5c66cbc6c353c8947cb0b0e95c64bea5fb4a7e6e4d275d77e2b98f5634

See more details on using hashes here.

File details

Details for the file notion_database-20210513.6-py3-none-any.whl.

File metadata

  • Download URL: notion_database-20210513.6-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.2

File hashes

Hashes for notion_database-20210513.6-py3-none-any.whl
Algorithm Hash digest
SHA256 7d4d3a86a4cf9e6f238e03814b46ee203b82a54cb89cdb3160a3cba55d4c35a0
MD5 82589540f384b5fb4ea6064b1128adb0
BLAKE2b-256 2e4844188d9914191fc8b1a47defa092266a4555545be06fde7dbd58132b93f9

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