gpt4 book ai didi

python - 适用于 Python 的 Azure SDK

转载 作者:行者123 更新时间:2023-12-03 05:41:26 25 4
gpt4 key购买 nike

我正在尝试使用 Python SDK 获取 Azure 租户中的订阅列表。

我想使用这个类:https://learn.microsoft.com/en-us/python/api/azure-mgmt-subscription/azure.mgmt.subscription.operations.subscriptionsoperations

list方法。

文档说“您不应该直接实例化此类,而应创建一个 Client 实例,该实例将为您创建该类并将其附加为属性。”

这是什么意思?

这就是我所拥有的:

client = SubscriptionClient(credentials)

test = SubscriptionClient.SubscriptionsOperations(client)

我得到这个:

AttributeError: type object 'SubscriptionClient' has no attribute 'SubscriptionsOperations'

谢谢

米克

最佳答案

我成功了:

client = SubscriptionClient(credentials) # correct
print (client.subscriptions)

这给了我azure.mgmt.subscription.operations.subscriptions_operations.SubscriptionsOperations,当我使用它时它会起作用。

这就是他们的意思:

“您不应直接实例化此类,而应创建一个 Client 实例,该实例将为您创建该类并将其附加为属性。”

关于python - 适用于 Python 的 Azure SDK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58411116/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com