如何使用主账户凭证查询子账户的 api 代币?

How to query api tokens for subaccounts using master account credentials?

我正在使用 python Twilio API。

给定一个子帐户 sid,是否有办法获取该子帐户的现有 api 密钥。仅使用主 api 凭据,不使用子帐户凭据。

我已尝试列出所有子账户并列出所有 api 密钥,但我无法获得指定子账户的 api 密钥。

此处为 Twilio 开发人员布道师。

您可以获得该帐户的 resources for a subaccount by fetching the subaccount itself first and then fetching the API keys

要在 Python 中执行此操作,它将如下所示:

# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "YOUR_ACCOUNT_TOKEN"
auth_token = "YOUR_AUTH_TOKEN"
client = Client(account_sid, auth_token)

subaccount = client.api.accounts("SUBACCOUNT_SID")
keys = subaccount.keys.list()

如果有帮助请告诉我。