我可以在最新的 azure-mgmt-media 和 Python 存储 sdk 中看到,用户需要为序列化器/反序列化器传递 2 个参数。我的 Python 经验很少,我不知道如何创建这些对象。
我找不到任何媒体示例,也没有带有最新签名 (3-01-18) 的存储示例。我只想创建一个媒体服务资产,但我不知道为什么需要传递这些参数,因为我使用的是标准 SDK 类型。谁能给我一些创建这些的例子吗?我可以找到
文档列出了:
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
这些类的两个示例是:
azure-sdk-for-python/azure-mgmt-media/azure/mgmt/media/operations/assets_operations.py
and
azure-sdk-for-python/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/blob_containers_operations.py
签名是:
定义init(自身、客户端、配置、序列化器、反序列化器):
谢谢!!!
编辑以附加我尝试创建媒体资产的问题的详细信息:
import azure.mgmt.media as azuremedia
client = azuremedia.AzureMediaServices(credentials,
subscription_id)
assetOper = operations.AssetsOperations(client, client.config,
client._serialize, client._deserialize)
asset = assetOper.create_or_update(resource_group_name=resourceGroup,
account_name=accountName,
asset_name=assetName,
parameters=None)
^但是 create_or_update 方法使用下面的代码,并且我客户端的 _serialize 没有 url 属性,因此它会崩溃!
从 create_or_update 方法的顶部:
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'accountName': self._serialize.url("account_name", account_name, 'str'),
'assetName': self._serialize.url("asset_name", asset_name, 'str')
}