retry bitwarden failed requests (#3391)

This commit is contained in:
LawyZheng
2025-09-08 16:44:23 +08:00
committed by GitHub
parent 1f51da17a9
commit dd3a1d4bf0

View File

@@ -715,14 +715,16 @@ class BitwardenService:
@staticmethod
async def _unlock_using_server(master_password: str) -> None:
status_response = await aiohttp_get_json(f"{BITWARDEN_SERVER_BASE_URL}/status")
status_response = await aiohttp_get_json(f"{BITWARDEN_SERVER_BASE_URL}/status", retry=3, retry_timeout=15)
status = status_response["data"]["template"]["status"]
if status != "unlocked":
await aiohttp_post(f"{BITWARDEN_SERVER_BASE_URL}/unlock", data={"password": master_password})
@staticmethod
async def _get_login_item_by_id_using_server(item_id: str) -> PasswordCredential:
response = await aiohttp_get_json(f"{BITWARDEN_SERVER_BASE_URL}/object/item/{item_id}")
response = await aiohttp_get_json(
f"{BITWARDEN_SERVER_BASE_URL}/object/item/{item_id}", retry=3, retry_timeout=15
)
if not response or response.get("success") is False:
raise BitwardenGetItemError(f"Failed to get login item by ID: {item_id}")