我正在尝试访问 blob 存储容器,这是我的代码:
from datetime import datetime
from azure.storage.blob import BlobServiceClient
from azure.storage.blob import generate_container_sas
from azure.storage.blob import ContainerSasPermissions
blob_storage_account = 'account name'
blob_storage_container = 'container name'
blob_storage_key = 'account key'
permission = ContainerSasPermissions(read=True, write=True, delete=True,
list=True,delete_previous_version=True, tag=True)
token = generate_container_sas(account_name=blob_storage_account,
container_name=blob_storage_container,
account_key=blob_storage_key,
permission=permission,
expiry='2050-2-25')
url = f'https://{blob_storage_account}.blob.core.windows.net'
blob_service_client = BlobServiceClient(url, credential=token)
container = blob_service_client.get_container_client(blob_storage_container)
container.list_blobs().next()
但是当我使用 list_blobs().next() 方法时出现此错误:
azure.core.exceptions.ClientAuthenticationError: Server failed to authenticate the request. Make sure
the value of Authorization header is formed correctly including the signature.
RequestId:42251c89-501e-0056-5156-0af114000000
Time:2021-02-24T02:41:46.8149241Z
ErrorCode:AuthenticationFailed
Error:None
我读了这个问题,他们指的是重置或调整时区,但这不起作用