Skip to main content

Table of Contents


notion_kit

Is for easier use notion-sdk-py.

  • Because Notion_sdk_py Usage documentation is less, cumbersome to use, and too many dictionary operations.

  • In order to make it easier to use Notion API, a lot of functions that may not be used have been created. :)


Usage

Install

  • pypi
    pip install notion-kit
    
  • Github
    pip install git+https://github.com/bluewhitep/notion_kit.git
    
  • Refer to the ./examples fold for details on usage

Quicky start

  1. Following the instruction for get token: Notion Authorization
  2. Use the token. [Recommend: Use environment variable]
    token = os.environ["NOTION_TOKEN"]
    
  3. Initalize notion_kit
    from notion_kit import kit as nkit
    notion_client = nkit.Client(token=token)
    
  4. Get id from notion url
    notion_url = "<Notion url>" 
    notion_id = nkit.get_id(url=notion_url)
    
  • Get data
    page = nkit.Page.get_data(notion_id)
    # or
    database = nkit.Database.get_data(notion_id)
    

Object

  • Notion_kit use class object operations
    • object to dict
      data_dict = data_object.Dict
      # or
      data_dict = data_object.asdict()
      
  • Special cases:
    • PropertyType object can use .full_dict() to get {Property_name: Property_type_value} dict.
      data_dict = data_object.full_dict()
      
    • PropertyType object can use .label_dict() to get short info dict.
      data_dict = data_object.label_dict()
      
      # short info dict:
      # {'name': Property_name,
      #  'type': Property_type,
      #  'id': Property_id
      # }
      

Functions

  • Database
    • ⭕️ Create a new database
    • ⭕️ Retrieve databse [Get page list in database]
    • ⭕️ Query database [Get database data]
    • ⭕️ Create / Update property
    • ❌ Delete database [Notion api not support]
  • Page
    • ⭕️ Create page in database / page
    • ⭕️ Retrieve (get page data)
    • ⭕️ Update property [ ** Page in Database]
    • ⭕️ Block [add / update / delete block]
    • ❌ Delete page [Notion api not support]
  • Block
    • ⭕️ Create
    • ⭕️ Retrieve (get block data and block childrens)
    • ⭕️ Update (rename function from notion_sdk_py)
    • ⭕️ Delete block
  • User
    • ⭕️ Get user list
    • ⭕️ Get user data by user_id
    • ⭕️ who am i: Get bot user data

Tips

Database non-create properties

  • status can't be updated, because notion api not support it.

    By notion api document, title, rich_text, number, select, multi_select, date, people, files, checkbox, url, email, phone_number, formula, relation, rollup, created_time, created_by, last_edited_time, last_edited_by can be updated.

  • rollup can't be updated on items.

Requirements

This package supports the following minimum versions:

  • Python >= 3.10

Reference


License

  • MIT License

Metadata

Release files for notion-kit-flexible 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for notion-kit-flexible 0.2.1
File Size Uploaded
notion_kit_flexible-0.2.1.tar.gz 31.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for notion-kit-flexible 0.2.1
File Interpreter ABI Platform
notion_kit_flexible-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 65.5 kB

Release files / notion_kit_flexible-0.2.1.tar.gz

Download URL notion_kit_flexible-0.2.1.tar.gz
Size 31.1 kB
Tags Source
SHA-256 checksum
How to use checksums
13fe6cc901354d974a99a808952bce0a2dc9695299e9e7a29cbb0a326accdeba
BLAKE2b-256 checksum
How to use checksums
9b3b766f1edefc43cf26b748b20b8fb8ff013b38d35bf4c1b98b1ea5a7355d7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.10.8 Darwin/22.4.0

Release files / notion_kit_flexible-0.2.1-py3-none-any.whl

Download URL notion_kit_flexible-0.2.1-py3-none-any.whl
Size 34.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b3d4f1a78de9d741777f778f8639b1dd58c809527617131820959ee871d04f3
BLAKE2b-256 checksum
How to use checksums
a3a291a9097bfef24c68ff597c2165d9a153d5d52420ba00d57f2501f23b88ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.10.8 Darwin/22.4.0

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page