notion-sdk-py icon indicating copy to clipboard operation
notion-sdk-py copied to clipboard

🐛 Boolean always evaluated to `True`

Open astariul opened this issue 3 years ago • 1 comments

I'm trying to generate text with styling.

For example, if I want bold + italic text on a blue background, I do the following :

from notion_client import Client

text = {
    "object": "block",
    "type": "paragraph",
    "paragraph": {
        "text": [
            {
                "type": "text",
                "text": {"content": "Test"},
                "annotations": {
                    "bold": True,
                    "italic": True,
                    "strikethrough": False,
                    "underline": False,
                    "code": False,
                    "color": "blue_background",
                },
            }
        ]
    },
}

notion = Client(auth=AUTH_TOKEN)
notion.blocks.children.append(block_id=BLOCK_ID, children=[text])

Expected result : image

Actual result : image

Every boolean annotations are set to True, I don't know why...


It works properly if simply remove the annotations I want to set to False :

text = {
    "object": "block",
    "type": "paragraph",
    "paragraph": {
        "text": [
            {
                "type": "text",
                "text": {"content": "Test"},
                "annotations": {
                    "bold": True,     # Note : I can set this to False, the result is the same
                    "italic": True,     # Note : I can set this to False, the result is the same
                    "color": "blue_background",
                },
            }
        ]
    },
}

astariul avatar May 22 '21 14:05 astariul

Hi @astariul, sorry for the long time to answer. Did you try calling the API with something else than notion-sdk-py (e.g. cURL) to check if the problem is on our side or Notion's?

ramnes avatar Jun 08 '21 08:06 ramnes

Closing due to the lack of answer but if you still have the issue (or anyone else), feel free to comment and I'll reopen!

ramnes avatar Nov 30 '22 18:11 ramnes