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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: botapi-py
3
- Version: 1.3.0
3
+ Version: 1.3.1
4
4
  Summary: A simple and flexible Python library to conveniently build Telegram bots using the Bot API.
5
5
  Requires-Dist: httpx>=0.28.1
6
6
  Requires-Dist: pydantic>=2.12.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "botapi-py"
3
- version = "1.3.0"
3
+ version = "1.3.1"
4
4
  description = "A simple and flexible Python library to conveniently build Telegram bots using the Bot API."
5
5
  # readme = "README.md"
6
6
  # authors = [
@@ -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
- except ImportError as e:
16
- logger.error(
17
- 'The Redis python library is not installed. Please install it to use this feature.'
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