如何获得azure python sdk的资源成本?



我正在努力弄清楚如何在azure中获得python sdk的资源成本

我已经创建了一个客户端"BillingManagementClient"但我不知道如何开始使用它并找到有关资源的成本信息,有人能分享他的知识吗?

要获得Azure Python SDK的资源成本,可以使用Billing作为SDK。Azure-mgmt-billing 6.0.0和azure-mgmt-consumption 8.0.0

_billing_management_client.py

def _send_request(self, http_request, **kwargs):
# type: (HttpRequest, Any) -> HttpResponse
"""Runs the network request through the client's chained policies.
:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.HttpResponse
"""
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
}
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
stream = kwargs.pop("stream", True)
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response

您可以参考使用azure计费API/SDK显示azure成本分析数据和入门-使用azure Python SDK管理资源

最新更新