I am using notion-client, a package that lets you use the notion api in python (the link is here: https://pypi.org/project/notion-client/).
My goal is to add text (e.g. "i just added this block of text, thanks to the notion api") to a to do list page where there is already some things written in bullet points: buy chicken breasts; see the definition of oedipus.
To accomplish this goal, i am following the following tutorial: https://developers.notion.com/docs/working-with-page-content
I've written the following code:
from pprint import pprint
from notion_client import Client
token = "00000000000000000000000" #censored token for security reasons
notion = Client(auth=token)
page_id = "000000000000000000" # the to do list page. it is also censored for security reasons
blocos_pagina = notion.blocks.children.list(page_id) # the to do list page is a block and the bullet lines containing, for example "buy chicken breasts" is a children of the block
# the problem is in the following lines:
# basically the following lines are to add content to the to do list page. In this example, for testing purposes, i want to add a hyperlink called notion api team that redirects to a twitter account
texto = notion.blocks.children.append({
"block_id": page_id,
"children": [
{
object: 'block',
type: 'paragraph',
"paragraph": {
"text": [
{
"type": 'text',
"text": {
"content": '– Notion API Team',
"link": {
"type": 'url',
"url": 'https://twitter.com/NotionAPI',
},
},
},
],
},
},
],
}
)
The output of this code is:
APIResponseError: Invalid request URL.