azure-sdk-for-python: Upload to IoT Edge Blob Storage: ExceptionMessage:The value 2019-12-12 provided for request header x-ms-version is invalid.
-
Package Name: Azure Blob storage v12.5.0
-
Package Version: 12.5.0
-
Operating System: PRETTY_NAME=“Raspbian GNU/Linux 10 (buster)” NAME=“Raspbian GNU/Linux” VERSION_ID=“10” VERSION=“10 (buster)” VERSION_CODENAME=buster ID=raspbian ID_LIKE=debian HOME_URL=“http://www.raspbian.org/” SUPPORT_URL=“http://www.raspbian.org/RaspbianForums” BUG_REPORT_URL=“http://www.raspbian.org/RaspbianBugs”
-
Python Version: Python 3.7.3 (default, Jul 25 2020, 13:03:44)
Describe the bug I’m trying to use Azure Python SDK to upload a file from a Raspberry Pi Zero to another IoT device running Azure IoT Edge Blob Storage module. I’m able to interact with the module by uploading/downloading files via Storage Explorer so I believe that is working as expected. However, I’m unable to use Azure SDK for Python to upload file to Blob storage service running on IoT Edge.
Error I’m seeing is: Traceback (most recent call last): File “/home/pi/.local/lib/python3.7/site-packages/azure/storage/blob/_upload_helpers.py”, line 106, in upload_block_blob **kwargs) File “/home/pi/.local/lib/python3.7/site-packages/azure/storage/blob/_generated/operations/_block_blob_operations.py”, line 222, in upload raise models.StorageErrorException(response, self._deserialize) azure.storage.blob._generated.models._models_py3.StorageErrorException: Operation returned an invalid status ‘The value for one of the HTTP headers is not in the correct format.’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “localblob.py”, line 15, in <module>
blob.upload_blob(data)
File “/home/pi/.local/lib/python3.7/site-packages/azure/core/tracing/decorator.py”, line 83, in wrapper_use_tracer
return func(*args, **kwargs)
File “/home/pi/.local/lib/python3.7/site-packages/azure/storage/blob/_blob_client.py”, line 539, in upload_blob
return upload_block_blob(**options)
File “/home/pi/.local/lib/python3.7/site-packages/azure/storage/blob/_upload_helpers.py”, line 156, in upload_block_blob
process_storage_error(error)
File “/home/pi/.local/lib/python3.7/site-packages/azure/storage/blob/_shared/response_handlers.py”, line 147, in process_storage_error
raise error
azure.core.exceptions.HttpResponseError: The value for one of the HTTP headers is not in the correct format.
RequestId:b0deb939-b93e-4d5a-a075-2ed4a22ec3aa
Time:2020-09-23T14:25:22.8346188Z
ErrorCode:InvalidHeaderValue
Error:None
HeaderName:x-ms-version
HeaderValue:2019-12-12
ExceptionDetails:None
ExceptionMessage:The value 2019-12-12 provided for request header x-ms-version is invalid.
StackTrace:Microsoft.Cis.Services.Nephos.Common.Protocols.Rest.InvalidHeaderProtocolException: The value 2019-12-12 provided for request header x-ms-version is invalid.
at Microsoft.Cis.Services.Nephos.Common.Protocols.Rest.BasicHttpProcessorWithAuthAndAccountContainer1.RunVersionCheck() in F:\Storage-XStore\src\XFE\common\Protocols\REST\src\BasicHttpProcessorWithAuthAndAccountContainerBase.cs:line 788 at Microsoft.Cis.Services.Nephos.Common.Protocols.Rest.BasicHttpProcessorWithAuthAndAccountContainer
1.ProcessImpl(AsyncIteratorContext`1 async)+MoveNext() in F:\Storage-XStore\src\XFE\common\Protocols\REST\src\BasicHttpProcessorWithAuthAndAccountContainerBase.cs:line 1537
To Reproduce Steps to reproduce the behavior:
-
Create IoT Edge device (I’m using a Raspberry PI 3 running Raspbian Buster for this) running Azure Blob Storage on IoT Edge (https://docs.microsoft.com/en-us/azure/iot-edge/how-to-store-data-blob)
-
On another local-network device use Azure SDK for Python (I’m using Raspberry Pi Zero W for this) to connect to the Blob service running on the IoT Edge device.
-
This is the python code I’m using (Python 3.7.3 running on Pi Zero) to connect to the IoT Edge Blob Service:
import os, uuid from azure.storage.blob import BlobClient
Connection string to the local Blob service
connection_string = “DefaultEndpointsProtocol=http;BlobEndpoint=http://192.168.0.12:11002/localblob;AccountName=localblob;AccountKey=[KEY]”
local_path = “./” local_file_name = “pizerocam.txt” upload_file_path = os.path.join(local_path, local_file_name) localcontainer = “pisynccontainer”
blob = BlobClient.from_connection_string(conn_str=connection_string, container_name=localcontainer, blob_name=local_file_name)
with open(upload_file_path, “rb”) as data: blob.upload_blob(data)
Expected behavior I expect the file pizerocam.txt to be uploaded to the blob container on the Blob Service running on IoT Edge
Screenshots https://gamgee.blob.core.windows.net/public/localBlobPythonError.png
Additional context I have verified that the local Blob service is working as I’ve connected to it with the exact same connection string using Azure Storage Explorer. I’m just having an issue getting the Python SDK to connect using this same connection string.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (4 by maintainers)
Commits related to this issue
- CodeGen from PR 13985 in Azure/azure-rest-api-specs Making Offer details and User Details required properties (#13985) * Making Offer details and User Details required properties and removing abandon... — committed to AzureSDKAutomation/azure-sdk-for-python by deleted user 3 years ago
- CodeGen from PR 14326 in Azure/azure-rest-api-specs OperationalInsights add missing Workspace features properties (#14326) * fixing the URL for Authorization (#13767) * [NetAppFiles] Fix protocolT... — committed to AzureSDKAutomation/azure-sdk-for-python by deleted user 3 years ago
- [AutoRelease] t2-loganalytics-2021-05-13-47912 (#18694) * CodeGen from PR 14326 in Azure/azure-rest-api-specs OperationalInsights add missing Workspace features properties (#14326) * fixing the U... — committed to Azure/azure-sdk-for-python by deleted user 3 years ago
- CodeGen from PR 14569 in Azure/azure-rest-api-specs Dabenham/cluster patch billing type (#14569) * Updated the models to include systemData and removed the supression f… (#13354) * Updated the mod... — committed to AzureSDKAutomation/azure-sdk-for-python by deleted user 3 years ago
- CodeGen from PR 15079 in Azure/azure-rest-api-specs Remove table retention limit from swagger (#15079) * Eiot sensors type alignment for new provider (#13780) * change boolean to enum * align n... — committed to AzureSDKAutomation/azure-sdk-for-python by deleted user 3 years ago
- CodeGen from PR 16690 in Azure/azure-rest-api-specs Add PUT operation for Tables endpoint and longRunning op for cluster Patch (#16690) * [Hub Generated] Review request for Microsoft.Consumption to a... — committed to AzureSDKAutomation/azure-sdk-for-python by deleted user 3 years ago
- [AutoRelease] t2-loganalytics-2021-11-16-55983 (#21776) * CodeGen from PR 16690 in Azure/azure-rest-api-specs Add PUT operation for Tables endpoint and longRunning op for cluster Patch (#16690) *... — committed to Azure/azure-sdk-for-python by deleted user 3 years ago
- CodeGen from PR 16690 in Azure/azure-rest-api-specs Add PUT operation for Tables endpoint and longRunning op for cluster Patch (#16690) * [Hub Generated] Review request for Microsoft.Consumption to a... — committed to AzureSDKAutomation/azure-sdk-for-python by deleted user 2 years ago
- CodeGen from PR 17183 in Azure/azure-rest-api-specs CDS component type update - mismatch between swagger and code values (#17183) * [Hub Generated] Review request for Microsoft.CostManagement to add... — committed to AzureSDKAutomation/azure-sdk-for-python by deleted user 2 years ago
- CodeGen from PR 17490 in Azure/azure-rest-api-specs [OperationalInsights] Remove unsupported version 2021-06-01 for "Tables" resource (#17490) * Dev weather microsoft.maps 1.0 (#13796) * Remove pr... — committed to AzureSDKAutomation/azure-sdk-for-python by deleted user 2 years ago
- CodeGen from PR 17379 in Azure/azure-rest-api-specs [OperationalInsights] Workspace provisioningState was set to readOnly (#17379) * [aks] fix vm size model and osDiskType description (#13763) * ... — committed to AzureSDKAutomation/azure-sdk-for-python by deleted user 2 years ago
- CodeGen from PR 17856 in Azure/azure-rest-api-specs Dev cost management microsoft.cost management 2022 02 01 preview (#17856) * Add new Azure Object Anchors API version 0.3-preview.0 (#17117) * ad... — committed to azure-sdk/azure-sdk-for-python by deleted user 2 years ago
i was having the same error with python. Added api_version=‘2019-07-07’ to BlobServiceClient solved the problem.
@xiafu-msft is this python package a different version than the one from pypi: https://pypi.org/project/azure-storage-blob/#history
If so, could you please update the pypi version?