locked
Azure SDK for Python: RRS feed

  • Question

  • I'm trying to upload binary data to Azure cloud storage using MS provided Python library. This is my code:

    azureBlob =BlobService(account_name=settings.azureBlobAccount, account_key=settings.azureBlobKey)
    azureBlob.put_block_blob_from_path('prdel', imageId, imageName)

    And this is API messages i got.
    -----
    WindowsAzureError: Unknown error (Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.)

    AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. 

    RequestId:9e2782b5-0001-000e-3a27-39d706000000 Time:2015-02-04T13:00:37.8177217ZThe Date header in the request is incorrect. 
    -----


    My time on server is correct. Could you tell me where is the problem and how to fix it?

    Thanks.
    Wednesday, February 4, 2015 2:57 PM

Answers

All replies

  • hi,

    Did you try to create blob container ? From your code, It seems that you are lack of processing of creation container. I recommend you refer to Azure official document:

    http://azure.microsoft.com/en-us/documentation/articles/storage-python-how-to-use-blob-storage/

    Regards,

    Will


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, February 5, 2015 8:06 AM
  • hi,

    I tried the sample provided in the link you gave, and I have the same issue:

    Writing to an append blob

    account_name = '...'
    account_key = '...'
    from azure.storage.blob import AppendBlobService
    append_blob_service = AppendBlobService(account_name = account_name, account_key = account_key)
    # The same containers can hold all types of blobs
    append_blob_service.create_container('mycontainer')
    # Append blobs must be created before they are appended to
    append_blob_service.create_blob('mycontainer', 'myappendblob')
    append_blob_service.append_blob_from_text('mycontainer', 'myappendblob', u'Hello, world!')

    append_blob = append_blob_service.get_blob_to_text('mycontainer', 'myappendblob')

    useradmin@vmpreubtapp1:~/TF1News/Scripts/Download$ python3 blob.py
    Traceback (most recent call last):
      File "/usr/local/lib/python3.4/dist-packages/azure/storage/storageclient.py", line 117, in _perform_request
        resp = self._filter(request)
      File "/usr/local/lib/python3.4/dist-packages/azure/storage/storageclient.py", line 109, in _perform_request_worker
        return self._httpclient.perform_request(request)
      File "/usr/local/lib/python3.4/dist-packages/azure/storage/_http/httpclient.py", line 222, in perform_request
        raise HTTPError(status, message, respheaders, respbody)
    azure.storage._http.HTTPError: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
    During handling of the above exception, another exception occurred:
    Traceback (most recent call last):
      File "blob.py", line 26, in <module>
        append_blob_service.append_blob_from_text('mycontainer', 'myappendblob', u'Hello, world!')
      File "/usr/local/lib/python3.4/dist-packages/azure/storage/blob/appendblobservice.py", line 452, in append_blob_from_text
        timeout=timeout)
      File "/usr/local/lib/python3.4/dist-packages/azure/storage/blob/appendblobservice.py", line 393, in append_blob_from_bytes
        timeout=timeout)
      File "/usr/local/lib/python3.4/dist-packages/azure/storage/blob/appendblobservice.py", line 511, in append_blob_from_stream
        timeout=timeout
      File "/usr/local/lib/python3.4/dist-packages/azure/storage/blob/_chunking.py", line 339, in _upload_blob_chunks
        range_ids = [uploader.process_chunk(start) for start in uploader.get_chunk_offsets()]
      File "/usr/local/lib/python3.4/dist-packages/azure/storage/blob/_chunking.py", line 339, in <listcomp>
        range_ids = [uploader.process_chunk(start) for start in uploader.get_chunk_offsets()]
      File "/usr/local/lib/python3.4/dist-packages/azure/storage/blob/_chunking.py", line 161, in process_chunk
        return self._upload_chunk_with_retries(chunk_offset, chunk_data)
      File "/usr/local/lib/python3.4/dist-packages/azure/storage/blob/_chunking.py", line 202, in _upload_chunk_with_retries
        range_id = self._upload_chunk(chunk_offset, chunk_data)
      File "/usr/local/lib/python3.4/dist-packages/azure/storage/blob/_chunking.py", line 253, in _upload_chunk
        timeout=self.timeout,
      File "/usr/local/lib/python3.4/dist-packages/azure/storage/blob/appendblobservice.py", line 268, in append_block
        response = self._perform_request(request)
      File "/usr/local/lib/python3.4/dist-packages/azure/storage/storageclient.py", line 125, in _perform_request
        _storage_error_handler(ex)
      File "/usr/local/lib/python3.4/dist-packages/azure/storage/_serialization.py", line 130, in _storage_error_handler
        return _general_error_handler(http_error)
      File "/usr/local/lib/python3.4/dist-packages/azure/storage/_error.py", line 71, in _general_error_handler
        raise AzureHttpError(message, http_error.status)
    azure.common.AzureHttpError: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
    <?xml version="1.0" encoding="utf-8"?><Error><Code>AuthenticationFailed</Code><Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
    RequestId:519f1174-0001-004c-271b-9a9edb000000
    Time:2016-04-19T09:10:51.2512503Z</Message><AuthenticationErrorDetail>The MAC signature found in the HTTP request 'BpTJrNU/8j13OV8rjoQTSN/TkxDtPUtexI1Xrvu+v+A=' is not the same as any computed signature. Server used following string to sign: 'PUT
    13
    application/x-www-form-urlencoded
    x-ms-date:Tue, 19 Apr 2016 09:10:50 GMT
    x-ms-version:2015-07-08
    /stopredata/mycontainer/myappendblob
    comp:appendblock'.</AuthenticationErrorDetail></Error>


    Tuesday, April 19, 2016 9:59 AM