Python: 如何使用共享访问密钥连接到 Azure 云存储?
Python: How to connect to Azure cloud storage using shared access key?
在 .net 中,我应该能够像这样使用 SAS 连接到 azure 存储:
var someTable = new CloudTable("https://account-name.table.core.windows.net/table-name?sv={key}");
如何在 python 中完成?我在 azure.storage.table 中找不到 CloudTable class(来自 python 的 azure sdk:https://github.com/Azure/azure-storage-python)
还有其他方法吗?
尝试如下操作:
import os
import json
from azure import *
from azure.storage import *
from azure.storage.table import TableService, Entity
table_service = TableService(account_name='[account-name]', sas_token='[sas-token]')
list = table_service.query_entities('[table-name]', top=100)
用实际值替换 [account-name]
、[sas-token]
和 [table-name]
。
此外,请不要在 [sas-token]
字段中包含 SAS 令牌中的 ?
。
来源:请参阅此处的文档 - https://github.com/Azure/azure-storage-python/blob/master/azure/storage/table/tableservice.py。
在 .net 中,我应该能够像这样使用 SAS 连接到 azure 存储:
var someTable = new CloudTable("https://account-name.table.core.windows.net/table-name?sv={key}");
如何在 python 中完成?我在 azure.storage.table 中找不到 CloudTable class(来自 python 的 azure sdk:https://github.com/Azure/azure-storage-python)
还有其他方法吗?
尝试如下操作:
import os
import json
from azure import *
from azure.storage import *
from azure.storage.table import TableService, Entity
table_service = TableService(account_name='[account-name]', sas_token='[sas-token]')
list = table_service.query_entities('[table-name]', top=100)
用实际值替换 [account-name]
、[sas-token]
和 [table-name]
。
此外,请不要在 [sas-token]
字段中包含 SAS 令牌中的 ?
。
来源:请参阅此处的文档 - https://github.com/Azure/azure-storage-python/blob/master/azure/storage/table/tableservice.py。