我已将 Azure SDK for python 下载到我的 Ubuntu(工具版本 0.8.16)。我正在尝试运行这段代码
from azure.storage import BlobService
blob_service = BlobService(account_name='Real_Name', account_key='Real_Key')
blob_service.create_container('mycontainer')
blob_service.create_container('mycontainer', x_ms_blob_public_access='container')
blob_service.put_block_blob_from_path(
'mycontainer',
'myblob',
'sunset.png',
x_ms_blob_content_type='image/png'
)
我已将其保存在 Test.py 下,并尝试使用以下命令运行它
python Test.py
在终端中,我收到此错误
Traceback (most recent call last):
File "Test.py", line 3, in <module>
blob_service.create_container('mycontainer')
File "/home/parallels/azure-sdk-for-python/azure/storage/blobservice.py", line 203, in create_container
_dont_fail_on_exist(ex)
File "/home/parallels/azure-sdk-for-python/azure/__init__.py", line 525, in _dont_fail_on_exist
raise error
azure.WindowsAzureError: Unknown error (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:98ce37f9-0001-003f-350e-7d3666000000
Time:2015-03-24T10:07:00.3385327Z</Message><AuthenticationErrorDetail>Request date header too old: 'Tue, 24 Mar 2015 09:06:59 GMT'</AuthenticationErrorDetail></Error>
如何解决这个问题,我做的一切都正确吗?
Thanks
从睡眠状态恢复 WSL 2(Linux 的 Windows 子系统)会话然后从 bash/zsh 命令行使用 Azure cli 后,由于时钟偏差,我遇到了类似的错误。这修复了时钟:
sudo hwclock -s -v
See: 使用 WSL 2 修复时钟偏差
Update:此错误似乎已在 WSL 内核版本 5.10.16.3-microsoft-standard-WSL2 中修复。升级后就没见过了看:https://github.com/microsoft/WSL/issues/5014#issuecomment-605243281
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)