Skip to content

Instantly share code, notes, and snippets.

@ftnext
Last active March 27, 2024 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ftnext/a00c0f049fc6624f677822b14e14aece to your computer and use it in GitHub Desktop.
Save ftnext/a00c0f049fc6624f677822b14e14aece to your computer and use it in GitHub Desktop.
import os
from notion_client import Client
parent_page_id = "ID from URL (pageをintegrationにコネクト)"
notion = Client(auth=os.environ["NOTION_TOKEN"]) # integration secret
new_page = notion.pages.create(
parent={"type": "page_id", "page_id": parent_page_id},
properties={
"title": {"title": [{"text": {"content": "notion-clientで作成"}}]}
},
children=[
{
"object": "block",
"type": "paragraph",
"paragraph": {
"rich_text": [
{
"type": "text",
"text": {"content": "Hello World\nこんにちは"},
}
]
},
}
],
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment