zalobot-python 0.2.0__tar.gz → 0.2.2__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: zalobot-python
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Python SDK for the Zalo Bot API
5
5
  Author: NovaH00
6
6
  Author-email: NovaH00 <trantay2006super@gmail.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "zalobot-python"
3
- version = "0.2.0"
3
+ version = "0.2.2"
4
4
  description = "Python SDK for the Zalo Bot API"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -1,4 +1,11 @@
1
- from .zalobot import ZaloBot, Context, AsyncWebhookHandler
1
+ from .zalobot import (
2
+ ZaloBot,
3
+ BotStates,
4
+ UnconfiguredWebhook,
5
+ ConfiguredWebhook,
6
+ Context,
7
+ AsyncWebhookHandler
8
+ )
2
9
  from .types import (
3
10
  SuccessfulResponse,
4
11
  ErrorResponse,
@@ -29,5 +36,8 @@ __all__ = [
29
36
  "Chat",
30
37
  "Message",
31
38
  "Event",
32
- "ZaloAPIError"
39
+ "ZaloAPIError",
40
+ "BotStates",
41
+ "UnconfiguredWebhook",
42
+ "ConfiguredWebhook"
33
43
  ]
@@ -0,0 +1,11 @@
1
+ from .core import ZaloBot, AsyncWebhookHandler, BotStates, UnconfiguredWebhook, ConfiguredWebhook
2
+ from .context import Context
3
+
4
+ __all__ = [
5
+ "ZaloBot",
6
+ "BotStates",
7
+ "UnconfiguredWebhook",
8
+ "ConfiguredWebhook",
9
+ "Context",
10
+ "AsyncWebhookHandler"
11
+ ]
@@ -2,7 +2,6 @@ import secrets
2
2
  from typing import Annotated, Protocol
3
3
 
4
4
  from ..types import (
5
- ZaloAPIResponse,
6
5
  ErrorResponse,
7
6
  ZaloAPIError,
8
7
  BotInfo,
@@ -148,13 +147,19 @@ class ZaloBot[S: BotStates = UnconfiguredWebhook]:
148
147
  self: ZaloBot[UnconfiguredWebhook],
149
148
  url: str
150
149
  ) -> ZaloBot[ConfiguredWebhook]:
151
-
150
+ """Upgrades the bot to support webhook mechanisms.
151
+
152
+ Warning:
153
+ This method will raise a `ZaloAPIError` if you attempt to configure
154
+ a webhook when one already exists.
155
+ """
152
156
  secret_token = secrets.token_urlsafe(192)
153
157
  _ = await self.setWebhook(url, secret_token)
154
158
 
155
159
  return ZaloBot(self._BOT_TOKEN, _secret_token = secret_token)
156
160
 
157
161
  def get_secret_token(self: ZaloBot[ConfiguredWebhook]):
162
+ """Gets the secret token generated by the configure_webhook"""
158
163
  return self._secret_token
159
164
 
160
165
  def add_webhook_handler(
@@ -1,8 +0,0 @@
1
- from .context import Context
2
- from .core import ZaloBot, AsyncWebhookHandler
3
-
4
- __all__ = [
5
- "Context",
6
- "ZaloBot",
7
- "AsyncWebhookHandler"
8
- ]
File without changes