Skip to content

Commit 53f4fc5

Browse files
committed
Update general.py
1 parent 9dd85a8 commit 53f4fc5

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

chizhik_api/endpoints/general.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@ def __init__(self, parent: "ChizhikAPI", CATALOG_URL: str):
2020
self._parent: ChizhikAPI = parent
2121
self.CATALOG_URL: str = CATALOG_URL
2222

23-
async def download_image(self, url: str, retry_attempts: int = 3) -> BytesIO:
23+
async def download_image(self,
24+
url: str,
25+
retry_attempts: int = 3,
26+
timeout: float = 10) -> BytesIO:
2427
"""Скачать изображение по URL."""
25-
retry_options = ExponentialRetry(attempts=retry_attempts, start_timeout=1.0)
28+
retry_options = ExponentialRetry(attempts=retry_attempts, start_timeout=3.0, max_timeout=timeout)
2629

2730
async with RetryClient(retry_options=retry_options) as retry_client:
2831
async with retry_client.get(url) as resp:

0 commit comments

Comments
 (0)