使用Azure blob Python API读取Azure blob内容-md5属性时为null



我们正试图从azure blob中获取content-md5属性,即使我们在azure容器属性中看到content-md5值,它也总是返回null。

为此,我们使用了pythonApi,浏览blob列表并读取blob属性,

container_client = blob_service_client.get_container_client("***")
blobs_list = container_client.list_blobs()
for props in blobs_list:

blob_with_md5[props.get("name")] = props.get("CONTENT-MD5")

我们需要启用此属性在Azure中可读吗?还是我们需要使用另一种python方法来实现这一点?如有任何帮助,我们将不胜感激。

请尝试以下操作:

container_client = blob_service_client.get_container_client("***")
blobs_list = container_client.list_blobs()
for blob in blobs_list:
blob_content_settings = blob.content_settings
blob_with_md5[props.get("name")] = blob_content_settings.content_md5

参考:

Blob属性:https://learn.microsoft.com/en-us/python/api/azure-storage-blob/azure.storage.blob.blobproperties?view=azure-python

内容设置:https://learn.microsoft.com/en-us/python/api/azure-storage-blob/azure.storage.blob.contentsettings?view=azure-python

最新更新