tenant_access_token
feishu.auth.tenant_access_token
¶
get_tenant_access_token
¶
获取租户访问凭证
这是一个通用函数,根据传入的参数自动判断是自建应用还是商店应用,并调用相应的函数。
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str
|
应用唯一标识(对于自建应用,以 |
required |
|
str
|
应用秘钥(对于自建应用)或者租户在飞书上的唯一标识(对于商店应用) |
required |
|
int
|
超时时间。默认为 120 秒。 |
120
|
Returns:
Type | Description |
---|---|
FlatDict
|
租户访问凭证 |
飞书文档
功能 | 实现函数 |
---|---|
获取自建应用的租户访问凭证 | [feishu.auth.app_access_token.get_tenant_access_token_internal][] |
获取商店应用的租户访问凭证 | [feishu.auth.app_access_token.get_tenant_access_token_store][] |
Examples:
Source code in feishu/auth/tenant_access_token.py
get_tenant_access_token_internal
¶
Python
get_tenant_access_token_internal(app_id: str, app_secret: str, timeout: int = 120) -> FlatDict
自建应用获取租户访问凭证
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str
|
应用唯一标识(以 |
required |
|
str
|
应用秘钥 |
required |
|
int
|
超时时间。默认为 120 秒。 |
120
|
Returns:
Type | Description |
---|---|
FlatDict
|
租户访问凭证 |
Examples:
Python Console Session | |
---|---|
Source code in feishu/auth/tenant_access_token.py
get_tenant_access_token_store
¶
Python
get_tenant_access_token_store(app_access_token: str, tenant_key: str, timeout: int = 120) -> FlatDict
商店应用获取租户访问凭证
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str
|
应用访问凭证(以 |
required |
|
str
|
租户在飞书上的唯一标识 |
required |
|
int
|
超时时间。默认为 120 秒。 |
120
|
Returns:
Type | Description |
---|---|
FlatDict
|
租户访问凭证 |
Examples:
Python Console Session | |
---|---|