block
notion.block
RESEARCH_API_PATH
module-attribute
Block
Notion Block objects. It converts values into block object structures specified by the notion api. Additionally, it can check whether given value is valid for the property.
Source code in ResearchToolkit/notion/block.py
__init_subclass__
Heading1
Bases: Block
Source code in ResearchToolkit/notion/block.py
Heading2
Bases: Heading1
Source code in ResearchToolkit/notion/block.py
Heading3
Bases: Heading1
Source code in ResearchToolkit/notion/block.py
Paragraph
Bases: Heading1
summary
Parameters:
-
value(_type_) –description
-
color(Optional[str], default:None) –description. Defaults to None.
-
children(Optional[Union[dict, List[dict]]], default:None) –children should be output or list of
Blockobject output. e.g) Paragraph("hello world")() or [Heading1("Tutorial")(), Paragraph("hello world")()]
Source code in ResearchToolkit/notion/block.py
Callout
Bases: Paragraph
summary
Parameters:
-
value(_type_) –description
-
color(Optional[str], default:None) –description. Defaults to None.
-
children(Optional[Union[dict, List[dict]]], default:None) –children should be output or list of
Blockobject output. e.g) Paragraph("hello world")() or [Heading1("Tutorial")(), Paragraph("hello world")()]
Source code in ResearchToolkit/notion/block.py
Quote
Bases: Paragraph
summary
Parameters:
-
value(_type_) –description
-
color(Optional[str], default:None) –description. Defaults to None.
-
children(Optional[Union[dict, List[dict]]], default:None) –children should be output or list of
Blockobject output. e.g) Paragraph("hello world")() or [Heading1("Tutorial")(), Paragraph("hello world")()]
Source code in ResearchToolkit/notion/block.py
BulletedListItem
BulletedListItem(value, color: Optional[str] = None, children: Optional[Union[dict, List[dict]]] = None)
Bases: Paragraph
summary
Parameters:
-
value(_type_) –description
-
color(Optional[str], default:None) –description. Defaults to None.
-
children(Optional[Union[dict, List[dict]]], default:None) –children should be output or list of
Blockobject output. e.g) Paragraph("hello world")() or [Heading1("Tutorial")(), Paragraph("hello world")()]
Source code in ResearchToolkit/notion/block.py
NumberedListItem
NumberedListItem(value, color: Optional[str] = None, children: Optional[Union[dict, List[dict]]] = None)
Bases: Paragraph
summary
Parameters:
-
value(_type_) –description
-
color(Optional[str], default:None) –description. Defaults to None.
-
children(Optional[Union[dict, List[dict]]], default:None) –children should be output or list of
Blockobject output. e.g) Paragraph("hello world")() or [Heading1("Tutorial")(), Paragraph("hello world")()]
Source code in ResearchToolkit/notion/block.py
ToDo
ToDo(value, checked: Optional[bool] = None, color: Optional[str] = None, children: Optional[Union[dict, List[dict]]] = None)
Toggle
Bases: Paragraph
summary
Parameters:
-
value(_type_) –description
-
color(Optional[str], default:None) –description. Defaults to None.
-
children(Optional[Union[dict, List[dict]]], default:None) –children should be output or list of
Blockobject output. e.g) Paragraph("hello world")() or [Heading1("Tutorial")(), Paragraph("hello world")()]
Source code in ResearchToolkit/notion/block.py
Code
Bases: Block
Source code in ResearchToolkit/notion/block.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
get_token
pascal_to_snake
register
make_rich_text_blocks
text를 block 길이 제한 만큼 잘라서 block들의 리스트로 변환합니다.
Parameters:
-
name(str) –block 종류
-
text(str) –컨텐츠 텍스트
Returns:
-
List[Dict]–List[Dict]: append_block_children에 입력할 수 있는 block들
Source code in ResearchToolkit/notion/block.py
retrieve_block_children
retrieve_block_children(page_id: str, token_path: str = RESEARCH_API_PATH, token: Optional[str] = None)
get all blocks on notion page. Args: page_id (str): notion page_id to search token_path (str, optional): description. Defaults to RESEARCH_API_PATH. token (Optional[str], optional): description. Defaults to None.
Returns:
-
_type_–request response code (200 if succeeded) and response text, block_children
Source code in ResearchToolkit/notion/block.py
find_database_on_page
find all database on page.
Returns:
-
Dict[str, str]–Dict[str, str]: dictionary whose keys are database ids and values are database names
Source code in ResearchToolkit/notion/block.py
append_block_children
append_block_children(page_id: str, block: Union[dict, List[dict]], token_path: str = RESEARCH_API_PATH, token: Optional[str] = None)
append block or blocks to a page
Parameters:
-
page_id(str) –description
-
block(Union[dict, List[dict]]) –output or list of outputs of
Blockobjects e.g) Paragraph("hello world")() or [Heading1("Tutorial")(), Paragraph("hello world")()] -
token_path(str, default:RESEARCH_API_PATH) –description. Defaults to RESEARCH_API_PATH.
-
token(Optional[str], default:None) –description. Defaults to None.
Returns:
-
_type_–request response code (200 if succeeded) and response text