Iterator
Iterator classes for working with paginated API responses.
BlockList
Bases:
A list of Block objects returned by the Notion API.
Source code in src/notional/iterator.py
50 51 52 53 |
|
DatabaseList
Bases:
A list of Database objects returned by the Notion API.
Source code in src/notional/iterator.py
62 63 64 65 |
|
EndpointIterator
Iterates over results from a paginated API response.
These objects may be reused, however they are not thread safe. For example, after creating the following iterator:
notion = notional.connect(auth=NOTION_AUTH_TOKEN)
query = EndpointIterator(notion.databases().query)
The iterator may be reused with different database ID's:
for items in query(database_id=first_db):
...
for items in query(database_id=second_db):
...
Objects returned by the iterator may also be converted to a specific type. This is most commonly used to wrap API objects with a higher-level object (such as ORM types).
Source code in src/notional/iterator.py
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 121 122 123 124 125 126 127 128 129 130 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 |
|
__call__(**kwargs)
Return a generator for this endpoint using the given parameters.
Source code in src/notional/iterator.py
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 |
|
__init__(endpoint, datatype=None)
Initialize an object list iterator for the specified endpoint.
If a class is provided, it will be constructued for each result returned by
this iterator. The constructor must accept a single argument, which is the
NotionObject
contained in the ObjectList
.
Source code in src/notional/iterator.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
|
list(**kwargs)
Collect all items from the endpoint as a list.
Source code in src/notional/iterator.py
162 163 164 165 166 167 168 169 170 |
|
ObjectList
Bases:
,
A paginated list of objects returned by the Notion API.
Source code in src/notional/iterator.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|
PageList
Bases:
A list of Page objects returned by the Notion API.
Source code in src/notional/iterator.py
56 57 58 59 |
|
PageOrDatabaseList
Bases:
A list of Page or Database objects returned by the Notion API.
Source code in src/notional/iterator.py
68 69 70 71 |
|
PropertyItemList
Bases:
A paginated list of property items returned by the Notion API.
Property item lists contain one or more pages of basic property items. These types do not typically match the schema for corresponding property values.
Source code in src/notional/iterator.py
80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
UserList
Bases:
A list of User objects returned by the Notion API.
Source code in src/notional/iterator.py
74 75 76 77 |
|