I was executing this code:
blob_service = BlobService(
account_name=azure_account,
account_key=azure_key
)
blob_service.put_block_blob_from_path(
'images',
'filename',
'dwa.jpg',
x_ms_blob_content_type='image/jpeg'
)
File "cdn.py", line 22, in main
x_ms_blob_content_type='image/jpeg'
File "/home/dawid/Pulpit/Projekty/venvs/ET/local/lib/python2.7/site-packages/azure/storage/blobservice.py", line 962, in put_block_blob_from_path
retry_wait)
File "/home/dawid/Pulpit/Projekty/venvs/ET/local/lib/python2.7/site-packages/azure/storage/blobservice.py", line 1059, in put_block_blob_from_file
x_ms_lease_id)
File "/home/dawid/Pulpit/Projekty/venvs/ET/local/lib/python2.7/site-packages/azure/storage/blobservice.py", line 869, in put_blob
request, self.authentication)
File "/home/dawid/Pulpit/Projekty/venvs/ET/local/lib/python2.7/site-packages/azure/storage/__init__.py", line 546, in _update_storage_blob_header
authentication.sign_request(request)
File "/home/dawid/Pulpit/Projekty/venvs/ET/local/lib/python2.7/site-packages/azure/storage/__init__.py", line 1242, in sign_request
self._add_authorization_header(request, string_to_sign)
File "/home/dawid/Pulpit/Projekty/venvs/ET/local/lib/python2.7/site-packages/azure/storage/__init__.py", line 1221, in _add_authorization_header
signature = _sign_string(self.account_key, string_to_sign)
File "/home/dawid/Pulpit/Projekty/venvs/ET/local/lib/python2.7/site-packages/azure/__init__.py", line 610, in _sign_string
key = _decode_base64_to_bytes(key)
File "/home/dawid/Pulpit/Projekty/venvs/ET/local/lib/python2.7/site-packages/azure/__init__.py", line 189, in _decode_base64_to_bytes
return base64.b64decode(data)
File "/usr/lib/python2.7/base64.py", line 76, in b64decode
raise TypeError(msg)
TypeError: Incorrect padding
Sounds like there is something wrong with the account key. Does it end with one or more '=' characters? Make sure that you include all of them.
Thanks for response! In fact, yest it ways because invalid key.
Should the account key end with more then one '='. I heard from a team member that the key must first be hmac encoded https://docs.python.org/2/library/hmac.html?
Hi @gregdegruy
Please note that the storage teams now owns this client directly:
https://github.com/Azure/azure-storage-python
You might to ask them directly, since I don't know what are the current constraints
Thanks,
Most helpful comment
Sounds like there is something wrong with the account key. Does it end with one or more '=' characters? Make sure that you include all of them.