botapi-py 1.3.0__tar.gz → 1.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {botapi_py-1.3.0 → botapi_py-1.3.1}/PKG-INFO +1 -1
- {botapi_py-1.3.0 → botapi_py-1.3.1}/pyproject.toml +1 -1
- {botapi_py-1.3.0 → botapi_py-1.3.1}/src/botapi/dispatchers/redis_pubsub_handler.py +8 -7
- {botapi_py-1.3.0 → botapi_py-1.3.1}/src/botapi/__init__.py +0 -0
- {botapi_py-1.3.0 → botapi_py-1.3.1}/src/botapi/__init__.pyi +0 -0
- {botapi_py-1.3.0 → botapi_py-1.3.1}/src/botapi/api.py +0 -0
- {botapi_py-1.3.0 → botapi_py-1.3.1}/src/botapi/boilerplate.py +0 -0
- {botapi_py-1.3.0 → botapi_py-1.3.1}/src/botapi/core.py +0 -0
- {botapi_py-1.3.0 → botapi_py-1.3.1}/src/botapi/dispatchers/__init__.py +0 -0
- {botapi_py-1.3.0 → botapi_py-1.3.1}/src/botapi/dispatchers/get_updates_handler.py +0 -0
- {botapi_py-1.3.0 → botapi_py-1.3.1}/src/botapi/enums.py +0 -0
- {botapi_py-1.3.0 → botapi_py-1.3.1}/src/botapi/errors.py +0 -0
- {botapi_py-1.3.0 → botapi_py-1.3.1}/src/botapi/types.py +0 -0
- {botapi_py-1.3.0 → botapi_py-1.3.1}/src/botapi/utils.py +0 -0
|
@@ -7,17 +7,15 @@ from typing import Any, Callable, Coroutine, TypeAlias
|
|
|
7
7
|
import pydantic
|
|
8
8
|
from botapi.types import Update
|
|
9
9
|
|
|
10
|
-
logger = logging.getLogger(__name__)
|
|
11
|
-
|
|
12
10
|
try:
|
|
13
11
|
import redis.asyncio as redis
|
|
14
12
|
from redis.asyncio.client import PubSub
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
)
|
|
19
|
-
raise e
|
|
13
|
+
_has_redis = True
|
|
14
|
+
except ImportError:
|
|
15
|
+
_has_redis = False
|
|
20
16
|
|
|
17
|
+
logger = logging.getLogger(__name__)
|
|
18
|
+
|
|
21
19
|
UpdateHandler: TypeAlias = Callable[[Update], Coroutine[Any, Any, None]]
|
|
22
20
|
|
|
23
21
|
|
|
@@ -54,6 +52,9 @@ class RedisPubSubAsyncDispatcher:
|
|
|
54
52
|
shutdown_wait_timeout (float, optional):
|
|
55
53
|
Timeout in seconds to wait for pending tasks to complete on shutdown.
|
|
56
54
|
'''
|
|
55
|
+
if not _has_redis:
|
|
56
|
+
raise ImportError('redis-py is not installed. Install `botapi-py[redis]` to use this dispatcher.')
|
|
57
|
+
|
|
57
58
|
self.redis_client = redis_client
|
|
58
59
|
self.update_handler = update_handler
|
|
59
60
|
self.pubsub_channel = pubsub_channel
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|