【问题标题】:HTTP header error using the Python SDK for Azure使用 Python SDK for Azure 的 HTTP 标头错误
【发布时间】:2014-11-20 16:10:38
【问题描述】:

我从 Microsoft Azure SDK for Python (https://github.com/Azure/azure-sdk-for-python) 开始,但我遇到了问题。

我正在使用 Scientific Linux,并按照以下步骤安装了适用于 Python 3.4 的 SDK:

(而不是 SDK 目录) python setup.py 安装

之后我创建了一个简单的脚本来测试连接:

from azure.storage import BlobService

blob_service = BlobService(account_name='thename', account_key='Mxxxxxxx3w==' )

blob_service.create_container('testcontainer')

for i in blob_service.list_containers():
        print(i.name)

按照本文档: http://blogs.msdn.com/b/tconte/archive/2013/04/17/how-to-interact-with-windows-azure-blob-storage-from-linux-using-python.aspx http://azure.microsoft.com/en-us/documentation/articles/storage-python-how-to-use-blob-storage/#large-blobs

但不工作,我总是收到同样的错误:

python3 test.py

Traceback (most recent call last):
  File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/storage/storageclient.py", line 143, in _perform_request
  File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/storage/storageclient.py", line 132, in _perform_request_worker
  File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/http/httpclient.py", line 247, in perform_request
azure.http.HTTPError: 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 "test.py", line 21, in <module>
    blob_service.create_container('testcontainer')
  File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/storage/blobservice.py", line 192, in create_container
  File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/__init__.py", line 905, in _dont_fail_on_exist
  File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/storage/blobservice.py", line 189, in create_container
  File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/storage/storageclient.py", line 150, in _perform_request
  File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/storage/__init__.py", line 889, in _storage_error_handler
  File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/__init__.py", line 929, in _general_error_handler
azure.WindowsAzureError: Unknown error (The value for one of the HTTP headers is not in the correct format.)
<?xml version="1.0" encoding="utf-8"?><Error><Code>InvalidHeaderValue</Code><Message>The value for one of the HTTP headers is not in the correct format.
RequestId:b37c5584-0001-002b-24b8-c2c245000000
Time:2014-11-19T14:54:38.9378626Z</Message><HeaderName>x-ms-version</HeaderName><HeaderValue>2012-02-12</HeaderValue></Error>

在此先致谢并致以最诚挚的问候。

【问题讨论】:

    标签: python linux azure


    【解决方案1】:

    我也有同样的问题。我相信这是一个库错误,但作者尚未发表意见。

    看起来响应说明了版本,但它实际上给了你错误的标题。它的值应该是“2014-02-14”,你可以做https://github.com/Azure/azure-sdk-for-python/pull/289中的修复。

    希望这将得到解决,并且没有人会阅读此答案。干杯!

    【讨论】:

      猜你喜欢
      • 2021-04-26
      • 1970-01-01
      • 2017-04-21
      • 2018-04-23
      • 2018-11-02
      • 1970-01-01
      • 2013-10-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多