Blocks
Wrapper for Notion API blocks.
Blocks are the base for all Notion content.
Block
Bases:
,
A standard block object in Notion.
Calling the block will expose the nested data in the object.
Source code in src/notional/blocks.py
123 124 125 126 127 |
|
Bookmark
Bases:
A bookmark block in Notion.
Source code in src/notional/blocks.py
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 |
|
Markdown
property
Return the contents of this block as markdown text.
URL
property
Return the URL contained in this Bookmark
block.
__compose__(url)
classmethod
Compose a new Bookmark
block from a specific URL.
Source code in src/notional/blocks.py
521 522 523 524 |
|
Breadcrumb
Bases:
A breadcrumb block in Notion.
Source code in src/notional/blocks.py
475 476 477 478 479 480 481 |
|
BulletedListItem
Bases:
,
A bulleted list item in Notion.
Source code in src/notional/blocks.py
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 |
|
Markdown
property
Return the contents of this block as markdown text.
Callout
Bases:
,
A callout block in Notion.
Source code in src/notional/blocks.py
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 |
|
__compose__(text, emoji=None, color=FullColor.GRAY_BACKGROUND)
classmethod
Compose a Callout
block from the given text, emoji and color.
Source code in src/notional/blocks.py
347 348 349 350 351 352 353 354 355 356 357 358 359 |
|
ChildDatabase
Bases:
A child database block in Notion.
Source code in src/notional/blocks.py
616 617 618 619 620 621 622 |
|
ChildPage
Bases:
A child page block in Notion.
Source code in src/notional/blocks.py
607 608 609 610 611 612 613 |
|
Code
Bases:
A code block in Notion.
Source code in src/notional/blocks.py
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
|
Markdown
property
Return the contents of this block as markdown text.
__compose__(text, lang=CodingLanguage.PLAIN_TEXT)
classmethod
Compose a Code
block from the given text and language.
Source code in src/notional/blocks.py
315 316 317 318 319 320 |
|
Column
Bases:
,
A column block in Notion.
Source code in src/notional/blocks.py
625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 |
|
__compose__(*blocks)
classmethod
Create a new Column
block with the given blocks as children.
Source code in src/notional/blocks.py
635 636 637 638 639 640 641 642 643 |
|
ColumnList
Bases:
,
A column list block in Notion.
Source code in src/notional/blocks.py
646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 |
|
__compose__(*columns)
classmethod
Create a new Column
block with the given blocks as children.
Source code in src/notional/blocks.py
656 657 658 659 660 661 662 663 664 |
|
DataRecord
Bases:
The base type for all Notion API records.
Source code in src/notional/blocks.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
|
Database
Bases:
A database record type.
Source code in src/notional/blocks.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
Title
property
Return the title of this database as plain text.
Divider
Bases:
A divider block in Notion.
Source code in src/notional/blocks.py
455 456 457 458 459 460 461 462 463 |
|
Markdown
property
Return the contents of this block as markdown text.
Embed
Bases:
An embed block in Notion.
Source code in src/notional/blocks.py
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 |
|
Markdown
property
Return the contents of this block as markdown text.
URL
property
Return the URL contained in this Embed
block.
__compose__(url)
classmethod
Create a new Embed
block from the given URL.
Source code in src/notional/blocks.py
492 493 494 495 |
|
Equation
Bases:
An equation block in Notion.
Source code in src/notional/blocks.py
569 570 571 572 573 574 575 576 577 578 579 580 |
|
__compose__(expr)
classmethod
Create a new Equation
block from the given expression.
Source code in src/notional/blocks.py
577 578 579 580 |
|
File
Bases:
A file block in Notion.
Source code in src/notional/blocks.py
583 584 585 586 |
|
Heading1
Bases:
A heading_1 block in Notion.
Source code in src/notional/blocks.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
|
Markdown
property
Return the contents of this block as markdown text.
Heading2
Bases:
A heading_2 block in Notion.
Source code in src/notional/blocks.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
|
Markdown
property
Return the contents of this block as markdown text.
Heading3
Bases:
A heading_3 block in Notion.
Source code in src/notional/blocks.py
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
|
Markdown
property
Return the contents of this block as markdown text.
Image
Bases:
An image block in Notion.
Source code in src/notional/blocks.py
589 590 591 592 |
|
LinkPreview
Bases:
A link_preview block in Notion.
Source code in src/notional/blocks.py
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 |
|
Markdown
property
Return the contents of this block as markdown text.
URL
property
Return the URL contained in this LinkPreview
block.
__compose__(url)
classmethod
Create a new LinkPreview
block from the given URL.
Source code in src/notional/blocks.py
549 550 551 552 |
|
LinkToPage
Bases:
A link_to_page block in Notion.
Source code in src/notional/blocks.py
778 779 780 781 |
|
NumberedListItem
Bases:
,
A numbered list item in Notion.
Source code in src/notional/blocks.py
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 |
|
Markdown
property
Return the contents of this block as markdown text.
PDF
Bases:
A pdf block in Notion.
Source code in src/notional/blocks.py
601 602 603 604 |
|
Page
Bases:
A standard Notion page object.
Source code in src/notional/blocks.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
|
Title
property
Return the title of this page as a string.
The title of a page is stored in its properties. This method will examine the
page properties, looking for the appropriate title
entry and return as a
string.
__getitem__(name)
Indexer for the given property name.
:param name: the name of the property to get from the internal properties
Source code in src/notional/blocks.py
71 72 73 74 75 76 77 78 79 80 81 82 |
|
__setitem__(name, value)
Set the object data for the given property.
If value
is None
, the property data will be deleted from the page. This
does not affect the schema of the page, only the contents of the property.
:param name: the name of the property to set in the internal properties :param value: the new value for the given property
Source code in src/notional/blocks.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
Paragraph
Bases:
,
A paragraph block in Notion.
Source code in src/notional/blocks.py
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
Markdown
property
Return the contents of this block as markdown text.
Quote
Bases:
,
A quote block in Notion.
Source code in src/notional/blocks.py
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
|
Markdown
property
Return the contents of this block as markdown text.
SyncedBlock
Bases:
,
A synced_block block in Notion - either original or synced.
Source code in src/notional/blocks.py
784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 |
|
IsOriginal
property
Determine if this block represents the original content.
If this method returns False
, the block represents the sync'ed block.
Table
Bases:
,
A table block in Notion.
Source code in src/notional/blocks.py
725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 |
|
Width
property
Return the current width of this table.
__compose__(*rows)
classmethod
Create a new Table
block with the given rows.
Source code in src/notional/blocks.py
739 740 741 742 743 744 745 746 747 |
|
append(block)
Append the given row to this table.
This method is only applicable when creating a new Table
block. In order to
add rows to an existing Table
, use the blocks.children.append()
endpoint.
When adding a row, this method will rase an exception if the width does not match the expected number of cells for existing rows in the block.
Source code in src/notional/blocks.py
749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 |
|
TableOfContents
Bases:
A table_of_contents block in Notion.
Source code in src/notional/blocks.py
466 467 468 469 470 471 472 |
|
TableRow
Bases:
A table_row block in Notion.
Source code in src/notional/blocks.py
667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 |
|
Width
property
Return the width (number of cells) in this TableRow
.
__compose__(*cells)
classmethod
Create a new TableRow
block with the given cell contents.
Source code in src/notional/blocks.py
689 690 691 692 693 694 695 696 697 |
|
__getitem__(cell_num)
Return the cell content for the requested column.
Source code in src/notional/blocks.py
685 686 687 |
|
append(text)
Append the given text as a new cell in this TableRow
.
text
may be a string, RichTextObject
or a list of RichTextObject
's.
:param text: the text content to append
Source code in src/notional/blocks.py
699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 |
|
Template
Bases:
,
A template block in Notion.
Source code in src/notional/blocks.py
802 803 804 805 806 807 808 809 |
|
TextBlock
Bases:
,
A standard text block object in Notion.
Source code in src/notional/blocks.py
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 |
|
PlainText
property
Return the contents of this Block as plain text.
__text__
property
Provide shorthand access to the nested text content in this block.
__compose__(*text)
classmethod
Compose a TextBlock
from the given text items.
Source code in src/notional/blocks.py
150 151 152 153 154 155 156 157 |
|
concat(*text)
Concatenate text (either RichTextObject
or str
items) to this block.
Source code in src/notional/blocks.py
159 160 161 162 163 164 165 166 167 |
|
ToDo
Bases:
,
A todo list item in Notion.
Source code in src/notional/blocks.py
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 |
|
IsChecked
property
Determine if this ToDo is marked as checked or not.
If the block is empty (e.g. no nested data), this method returns None
.
Markdown
property
Return the contents of this block as markdown text.
__compose__(text, checked=False, href=None)
classmethod
Compose a ToDo block from the given text and checked state.
Source code in src/notional/blocks.py
413 414 415 416 417 418 419 420 421 |
|
Toggle
Bases:
,
A toggle list item in Notion.
Source code in src/notional/blocks.py
444 445 446 447 448 449 450 451 452 |
|
UnsupportedBlock
Bases:
A placeholder for unsupported blocks in the API.
Source code in src/notional/blocks.py
130 131 132 133 134 135 136 |
|
Video
Bases:
A video block in Notion.
Source code in src/notional/blocks.py
595 596 597 598 |
|
WithChildrenMixin
Mixin for blocks that support children blocks.
Source code in src/notional/blocks.py
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 |
|
__children__
property
Provide short-hand access to the children in this block.
__iadd__(block)
Append the given block to the children of this parent in place.
Source code in src/notional/blocks.py
187 188 189 190 |
|
append(block)
Append the given block to the children of this parent.
Source code in src/notional/blocks.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
|