我使用Web界面在Azure存储帐户上创建了共享访问签名(SAS)令牌。令牌看起来像Azure Blob Store SAS令牌缺失服务资源字段
?sv=xxxx-xx-xx&ss=b&srt=sco&sp=rl&se=xxxx-xx-xxTxx:xx:xxZ&st=xxxx-xx-xxTxx:xx:xxZ&spr=https&sig=xxxxxxxxxxxxxxxxxxxxxx
的SAS令牌这里缺少服务资源的sr
领域。我必须手动将sr=b
添加到查询字符串才能使其工作。我必须做错事,因为这看起来非常挑剔。
from azure.storage.blob import BlockBlobService
sas_token = "?sv=xxxx-xx-xx&ss=b&srt=sco&sp=rl&se=xxxx-xx-xxTxx:xx:xxZ&st=xxxx-xx-xxTxx:xx:xxZ&spr=https&sig=xxxxxxxxxxxxxxxxxxxxxx"
sas_token = "?sr=b&" + sas_token[1:]
serv = BlockBlobService(account_name='myaccount', sas_token=sas_token)
for cont in serv.list_containers():
print cont.name
没有sas_token = "?sr=b&" + sas_token[1:]
我得到的错误:
sr is mandatory. Cannot be empty
而且如果sr=b
字段不是第一次查询,我得到一个验证错误,如
Access without signed identifier cannot have time window more than 1 hour
您使用的是什么版本的Python SDK? –
我使用python 2.7.6和azure-storage 0.34.3 –