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.
- {zalobot_python-0.2.0 → zalobot_python-0.2.2}/PKG-INFO +1 -1
- {zalobot_python-0.2.0 → zalobot_python-0.2.2}/pyproject.toml +1 -1
- {zalobot_python-0.2.0 → zalobot_python-0.2.2}/src/zalobot_python/__init__.py +12 -2
- zalobot_python-0.2.2/src/zalobot_python/zalobot/__init__.py +11 -0
- {zalobot_python-0.2.0 → zalobot_python-0.2.2}/src/zalobot_python/zalobot/core.py +7 -2
- zalobot_python-0.2.0/src/zalobot_python/zalobot/__init__.py +0 -8
- {zalobot_python-0.2.0 → zalobot_python-0.2.2}/README.md +0 -0
- {zalobot_python-0.2.0 → zalobot_python-0.2.2}/src/zalobot_python/config.py +0 -0
- {zalobot_python-0.2.0 → zalobot_python-0.2.2}/src/zalobot_python/py.typed +0 -0
- {zalobot_python-0.2.0 → zalobot_python-0.2.2}/src/zalobot_python/types/__init__.py +0 -0
- {zalobot_python-0.2.0 → zalobot_python-0.2.2}/src/zalobot_python/types/entities.py +0 -0
- {zalobot_python-0.2.0 → zalobot_python-0.2.2}/src/zalobot_python/types/errors.py +0 -0
- {zalobot_python-0.2.0 → zalobot_python-0.2.2}/src/zalobot_python/types/responses.py +0 -0
- {zalobot_python-0.2.0 → zalobot_python-0.2.2}/src/zalobot_python/zalobot/context.py +0 -0
- {zalobot_python-0.2.0 → zalobot_python-0.2.2}/src/zalobot_python/zalobot/http.py +0 -0
- {zalobot_python-0.2.0 → zalobot_python-0.2.2}/src/zalobot_python/zalobot/interfaces.py +0 -0
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
from .zalobot import
|
|
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(
|
|
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
|