-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Print out MD5, but get a byte array. #13104
Description
-azure_storage_blob-12.3.2:
- Azure SDK for Python:
- Windows 10:
- Python 3.0:
Describe the bug
I have a customer, she wrote some code wanted to get a MD5 content, it was supposed to return a string, but she got a byte array.
To Reproduce
Steps to reproduce the behavior:
- Running the code below:
from azure.storage.blob import BlobServiceClient
blob_service_client = BlobServiceClient.from_connection_string(connect_str);
container_client = blob_service_client.get_container_client(container_name)
blob_list = container_client.list_blobs(name_starts_with=src);
for blob in blob_list:
print( blob.name + "\t" + str(blob.content_settings.content_md5) )
Output:
quickstart.txt bytearray(b'\x93\x8f1xZ\xc2]\xc1\xcb\x1f\xd5\x10\xef .\x92')
Expected behavior
Return result should be a string: 'k48xeFrCXcHLH9UQ7yAukg==
Screenshots
N/A
Additional context
Background information from my customer:
from azure.storage.blob import BlockBlobService
block_blob_service = BlockBlobService(account_name=acct_name, account_key=acct_key)
blob_list = block_blob_service.list_blobs(container_name, src, include='metadata')
for blob in blob_list:
print blob.name + "\t" + blob.properties.content_settings.content_md5
The code above works well. But we upgraded our system to python 3 and some featuresare gone, for example, 'blob_tier' is not an attribute of Blobproperties under BlockBlobService.
That is the reason we changed to BlobServiceClient. Then I encountered ‘md5’ issue.