我正在尝试使用Jupyter Notebook将Blob上传到Azure存储。我有一个示例代码如下:
from azure.storage.blob import BlockBlobService
accountName = "< account name>"
ContainerSAS = "<SAS key>"
containerName = "< container name>"
try:
sas_service = BlockBlobService(account_name=accountName, sas_token=ContainerSAS)
except Exception as e:
print("There was an error during SAS service creation. Details: {0}".format(e))
from azure.storage.blob import ContentSettings
blobName = "< blob name >"
try:
sas_service.create_blob_from_path(
'accountName',
'blobName',
'Chicago_Crime_Data-v2.csv',
content_settings=ContentSettings(content_type='Chicago_Crime_Data-v2/csv')
)
except Exception as e:
print("There was an error during blob uploading. Details: {0}".format(e))
但是我收到一条错误消息:详细信息:服务器无法验证请求。确保正确构成Authorization标头的值,包括签名。
我无法理解这里出了什么问题。我是新手。任何帮助将非常感激。谢谢。
编辑:我应该提供帐户名称,容器名称和密钥吗?
请确认您的帐户密钥是否正确,并确保正确设置系统时间,如果系统时间设置不正确,则可能会出现“无法验证”错误。