dev@locazia: fix misprint
This commit is contained in:
parent
d1ecb70f75
commit
b5abd7d03d
|
|
@ -14,7 +14,10 @@ class TonCenter:
|
||||||
self.api_key = api_key
|
self.api_key = api_key
|
||||||
self.last_used = time.time()
|
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={
|
async with AsyncClient(headers={
|
||||||
'Authorization': f"Bearer {self.api_key}"
|
'Authorization': f"Bearer {self.api_key}"
|
||||||
} if self.api_key else None) as client:
|
} if self.api_key else None) as client:
|
||||||
|
|
@ -35,7 +38,7 @@ class TonCenter:
|
||||||
return response.json()
|
return response.json()
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
make_log("Toncenter", f'Error while request {self.host}{endpoint}: {e}' + '\n' + response.text, level='error')
|
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):
|
async def send_boc(self, src: bytes):
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue