decorators
feishu.utils.decorators
¶
flexible_decorator
¶
元装饰器,使得装饰器可以在不接受参数时直接使用,也可以接受参数。
Examples:
For decorator defined as follows:
Python Console Session | |
---|---|
The following two are equivalent:
Source code in feishu/utils/decorators.py
authorize
¶
授权装饰器,用于自动注入 app_id 和 app_secret。
Source code in feishu/utils/decorators.py
pagination
¶
Python
pagination(early_stop: Callable | None = None)
分页装饰器,用于收集分页数据。
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Callable | None
|
判断是否提前停止的函数。默认为 |
None
|
注意:
该装饰器会读取函数参数中的 stop_on_page
和 stop_on_accum
参数,如果没有提供则使用默认值。
Source code in feishu/utils/decorators.py
Python | |
---|---|
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 171 172 173 174 175 176 177 178 179 180 181 182 183 |
|