I'm trying to create an Azure blob container using Python SDK with the below code. I'm getting an 'ErrorCode:InvalidHeaderValue' in the response.
I'm using the 'ConnectionString' from 'Access Keys' section from the Azure Portal of the storage account. And I don't think the connection is the issue since this line works ok blob_service_client = BlobServiceClient.from_connection_string(connection_string)
.
I used a clean venv for this and below are the library versions
azure-core==1.10.0
azure-storage-blob==12.7.1
import os
import yaml
from azure.storage.blob import ContainerClient, BlobServiceClient
def load_config():
dir_root = os.path.dirname(os.path.abspath(__file__))
with open (dir_root + "/config.yaml", "r") as yamlfile:
return yaml.load(yamlfile, Loader=yaml.FullLoader)
config = load_config()
connection_string = config['azure_storage_connectionstring']
blob_service_client = BlobServiceClient.from_connection_string(connection_string)
blob_service_client.create_container('testing')
Traceback (most recent call last):
File "/Users/anojshrestha/Documents/codes/gen2lake/project_azure/lib/python3.7/site-packages/azure/storage/blob/_container_client.py", line 292, in create_container
**kwargs)
File "/Users/anojshrestha/Documents/codes/gen2lake/project_azure/lib/python3.7/site-packages/azure/storage/blob/_generated/operations/_container_operations.py", line 134, in create
raise HttpResponseError(response=response, model=error)
azure.core.exceptions.HttpResponseError: 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:
.......
azure.core.exceptions.HttpResponseError: The value for one of the HTTP headers is not in the correct format.
RequestId:5X-601e-XXXX00ab-5368-f0c05f000000
Time:2021-01-22T02:43:22.3983063Z
ErrorCode:InvalidHeaderValue
Error:None
HeaderName:x-ms-version
HeaderValue:2020-04-08```
question from:
https://stackoverflow.com/questions/65838755/http-headers-is-not-in-the-correct-format-error-when-creating-azure-container 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…