【发布时间】:2021-06-19 02:11:57
【问题描述】:
我正在为 Azure Storage v12.x (doc) 使用 Python API。我正在尝试使用以下代码获取 blob 的租约:
credentials = ...
blob_client = BlobClient(account_url=ACCOUNT_URL, container_name=CONTAINER_NAME, blob_name=BLOB_NAME, credential=credentials)
lease_id_str = str(uuid.uuid4())
lease = blob_client.acquire_lease(lease_duration=60, lease_id=lease_id_str)
现在,如果租约不可用,我想重试。问题是“我应该如何通过重试获得租约?”
以下是我尝试过的几件事:
1.This documentation 谈论属性retry_connect、retry_read、retry_status。将这些作为附加参数添加到上述代码没有帮助。
2.关注this test case,我尝试过关注:
from azure.storage.blob import ExponentialRetry
retry = ExponentialRetry(initial_backoff=1, increment_base=3, retry_total=3)
lease = BlobLeaseClient(blob_client, lease_id=lease_id_str, retry_policy=retry)
它返回以下内容:
TypeError: init() 得到了一个意外的关键字参数“retry_policy”
【问题讨论】:
标签: python azure azure-storage azure-blob-storage