本文整理汇总了Python中azure.storage.blob.BlobService.iterate_blobs方法的典型用法代码示例。如果您正苦于以下问题:Python BlobService.iterate_blobs方法的具体用法?Python BlobService.iterate_blobs怎么用?Python BlobService.iterate_blobs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类azure.storage.blob.BlobService
的用法示例。
在下文中一共展示了BlobService.iterate_blobs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_container_details
# 需要导入模块: from azure.storage.blob import BlobService [as 别名]
# 或者: from azure.storage.blob.BlobService import iterate_blobs [as 别名]
def get_container_details(creds, resource_group_name, account_name, container_name):
keys = _get_storage_account_keys(creds, resource_group_name, account_name)
blob_service = BlobService(account_name, keys.key1)
model = StorageAccountContainerDetails()
model.container_name = container_name
model.sas_policy = _get_shared_access_policy(BlobSharedAccessPermissions.READ)
model.blobs = []
for blob in blob_service.iterate_blobs(container_name, include="metadata"):
sas_token = blob_service.generate_shared_access_signature(container_name, blob.name, model.sas_policy)
blob.sas_url = blob_service.make_blob_url(container_name, blob.name, sas_token=sas_token)
raw_md5 = b64decode(blob.properties.content_md5)
hex_md5 = "".join([hex(val)[2:] for val in raw_md5])
blob.properties.content_hex_md5 = hex_md5
model.blobs.append(blob)
return model