Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
leshchenko1979 committed Jul 18, 2024
1 parent 931ed22 commit 6b2528b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions fast_bitrix24/bitrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import asyncio
import functools as ft
from contextlib import contextmanager
from typing import Iterable, Union
from typing import Iterable, Union, Awaitable

import aiohttp
import icontract
Expand All @@ -25,10 +25,11 @@
class BitrixAsync:
"""Клиент для асинхронных запросов к Битрикс24."""

@beartype
def __init__(
self,
webhook: str,
token_func: callable = None,
token_func: Awaitable = None,
verbose: bool = True,
respect_velocity_policy: bool = True,
request_pool_size: int = 50,
Expand Down
6 changes: 3 additions & 3 deletions fast_bitrix24/srh.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ServerRequestHandler:
def __init__(
self,
webhook: str,
token_func: callable,
token_func,
respect_velocity_policy: bool,
request_pool_size: int,
requests_per_second: float,
Expand Down Expand Up @@ -176,7 +176,7 @@ async def request_attempt(self, method, params=None) -> dict:
async with self.acquire(method):
logger.debug(f"Requesting {{'method': {method}, 'params': {params}}}")

params_with_auth = params.copy()
params_with_auth = params.copy() if params else {}

if self.token_func: # если требуется авторизация

Expand Down Expand Up @@ -318,5 +318,5 @@ async def update_token(self):
"""Запросить новый токен авторизации."""

self.token_request_in_progress.clear()
self.token = self.token_func
self.token = await self.token_func()
self.token_request_in_progress.set()

0 comments on commit 6b2528b

Please sign in to comment.