Skip to main content

Unofficial Python API client for Notion.so

Project description

Notion Util

このプロジェクトは、Notion.soの非公式Python APIクライアントです。 NotionページのMarkdown変換やNotion Databaseのcsv変換が可能です。

インストール

このパッケージをインストールするには、以下のコマンドを実行してください。

pip install notion-util

使い方

export NOTION_SECRET=secret_xxxxxxxxxxxx
from notion_util import NotionUtil

# notion page url
url = "https://www.notion.so/xxxx"

notion = NotionUtil()
markdown_content = notion.get_page_markdown(url, recursive=False)
print(markdown_content)
from notion_util import Notion, markdown_to_notion_blocks

notion = Notion()
# ここで、NotionのデータベースIDと新しいページのタイトルを指定する
database_id = os.getenv("DATABASE_ID")
page_title = "New Page From Markdown"
# Notionのプロパティを設定
properties = {"URL": {"url": "http://example.com"}}
# 新しいページを作成
res = notion.create_notion_page(database_id, page_title, properties)
# Markdownファイルを読み込む
with open("README.md", "r") as md_file:
    # MarkdownをNotionブロックに変換
    blocks = markdown_to_notion_blocks(md_file.read())
    # Notionページにブロックを追加
    notion.append_blocks_to_page(res["id"], blocks)

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_util-1.0.0.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

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

notion_util-1.0.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file notion_util-1.0.0.tar.gz.

File metadata

  • Download URL: notion_util-1.0.0.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.18

File hashes

Hashes for notion_util-1.0.0.tar.gz
Algorithm Hash digest
SHA256 eb5b77b61257a33650e4154ef16e3ef49ed85c8d13244886213afc1ed3db1392
MD5 2d21012283f0b7d9742b81436348ac18
BLAKE2b-256 d00f6125537f60b4438d5bc0992767c69d3ebc583ee1a9671d5537fb0a952804

See more details on using hashes here.

File details

Details for the file notion_util-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: notion_util-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.18

File hashes

Hashes for notion_util-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 295990849c8a52eae6dcd6115784172a45a69f6d0e00a72d1c72e6e56289dc36
MD5 9a32f20c93e4908ca24c4ffe43d2b86d
BLAKE2b-256 6aee5646b064e36dfd665c261693462f584290131ed1d6ee4fe46aceb0c38299

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