dev@locazia: fix misprint

This commit is contained in:
user 2024-03-08 00:42:31 +03:00
parent d1ecb70f75
commit b5abd7d03d
1 changed files with 5 additions and 2 deletions

View File

@ -14,7 +14,10 @@ class TonCenter:
self.api_key = api_key
self.last_used = time.time()
async def request(self, method: str, endpoint: str, *args, **kwargs) -> dict:
async def request(self, method: str, endpoint: str, *args, tries_count=0, **kwargs) -> dict:
if tries_count > 3:
raise Exception(f'Error while toncenter request {endpoint}: {tries_count}')
async with AsyncClient(headers={
'Authorization': f"Bearer {self.api_key}"
} if self.api_key else None) as client:
@ -35,7 +38,7 @@ class TonCenter:
return response.json()
except BaseException as e:
make_log("Toncenter", f'Error while request {self.host}{endpoint}: {e}' + '\n' + response.text, level='error')
return await self.request(method, endpoint, *args, **kwargs)
return await self.request(method, endpoint, *args, tries_count=(tries_count + 1), **kwargs)
async def send_boc(self, src: bytes):
try: