satori-python 0.14.4__tar.gz → 0.14.5__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.
Files changed (29) hide show
  1. {satori_python-0.14.4 → satori_python-0.14.5}/LICENSE +21 -21
  2. {satori_python-0.14.4 → satori_python-0.14.5}/PKG-INFO +1 -1
  3. {satori_python-0.14.4 → satori_python-0.14.5}/README.md +113 -113
  4. {satori_python-0.14.4 → satori_python-0.14.5}/pyproject.toml +1 -1
  5. {satori_python-0.14.4 → satori_python-0.14.5}/src/satori/__init__.py +46 -46
  6. {satori_python-0.14.4 → satori_python-0.14.5}/src/satori/client/__init__.py +290 -290
  7. {satori_python-0.14.4 → satori_python-0.14.5}/src/satori/client/account.py +82 -82
  8. {satori_python-0.14.4 → satori_python-0.14.5}/src/satori/client/account.pyi +565 -565
  9. {satori_python-0.14.4 → satori_python-0.14.5}/src/satori/client/network/base.py +48 -48
  10. {satori_python-0.14.4 → satori_python-0.14.5}/src/satori/client/network/util.py +42 -42
  11. {satori_python-0.14.4 → satori_python-0.14.5}/src/satori/client/network/webhook.py +122 -122
  12. {satori_python-0.14.4 → satori_python-0.14.5}/src/satori/client/network/websocket.py +182 -182
  13. {satori_python-0.14.4 → satori_python-0.14.5}/src/satori/client/protocol.py +768 -768
  14. {satori_python-0.14.4 → satori_python-0.14.5}/src/satori/config.py +67 -67
  15. {satori_python-0.14.4 → satori_python-0.14.5}/src/satori/const.py +73 -73
  16. {satori_python-0.14.4 → satori_python-0.14.5}/src/satori/element.py +631 -631
  17. {satori_python-0.14.4 → satori_python-0.14.5}/src/satori/event.py +63 -63
  18. {satori_python-0.14.4 → satori_python-0.14.5}/src/satori/exception.py +34 -34
  19. {satori_python-0.14.4 → satori_python-0.14.5}/src/satori/model.py +392 -392
  20. {satori_python-0.14.4 → satori_python-0.14.5}/src/satori/parser.py +412 -412
  21. {satori_python-0.14.4 → satori_python-0.14.5}/src/satori/server/__init__.py +380 -379
  22. {satori_python-0.14.4 → satori_python-0.14.5}/src/satori/server/adapter.py +53 -52
  23. {satori_python-0.14.4 → satori_python-0.14.5}/src/satori/server/conection.py +44 -44
  24. {satori_python-0.14.4 → satori_python-0.14.5}/src/satori/server/formdata.py +13 -13
  25. {satori_python-0.14.4 → satori_python-0.14.5}/src/satori/server/model.py +46 -46
  26. {satori_python-0.14.4 → satori_python-0.14.5}/src/satori/server/route.py +418 -418
  27. satori_python-0.14.4/src/satori/server/deque.py → satori_python-0.14.5/src/satori/server/utils.py +38 -33
  28. {satori_python-0.14.4 → satori_python-0.14.5}/src/satori/utils.py +17 -17
  29. {satori_python-0.14.4 → satori_python-0.14.5}/src/satori/client/network/__init__.py +0 -0
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 RF-Tar-Railt
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2023 RF-Tar-Railt
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: satori-python
3
- Version: 0.14.4
3
+ Version: 0.14.5
4
4
  Summary: Satori Protocol SDK for python
5
5
  Home-page: https://github.com/RF-Tar-Railt/satori-python
6
6
  Author-Email: RF-Tar-Railt <rf_tar_railt@qq.com>
@@ -1,113 +1,113 @@
1
- # satori-python
2
-
3
- ![latest release](https://img.shields.io/github/release/RF-Tar-Railt/satori-python)
4
- [![Licence](https://img.shields.io/github/license/RF-Tar-Railt/satori-python)](https://github.com/RF-Tar-Railt/satori-python/blob/main/LICENSE)
5
- [![PyPI](https://img.shields.io/pypi/v/satori-python)](https://pypi.org/project/satori-python)
6
- [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/satori-python)](https://www.python.org/)
7
-
8
- 基于 [Satori](https://satori.js.org/zh-CN/) 协议的 Python 开发工具包
9
-
10
- ## 协议介绍
11
-
12
- [Satori Protocol](https://satori.js.org/zh-CN/)
13
-
14
- ### 协议端
15
-
16
- 目前提供了 `satori` 协议实现的有:
17
-
18
- - [Chronocat](https://chronocat.vercel.app)
19
- - Koishi (搭配 `@koishijs/plugin-server`)
20
-
21
- ### 使用该 SDK 的框架
22
-
23
- - [`Entari`](https://github.com/ArcletProject/Entari)
24
-
25
- ## 安装
26
-
27
- 安装完整体:
28
- ```shell
29
- pip install satori-python
30
- ```
31
-
32
- 只安装基础部分:
33
- ```shell
34
- pip install satori-python-core
35
- ```
36
-
37
- 只安装客户端部分:
38
- ```shell
39
- pip install satori-python-client
40
- ```
41
-
42
- 只安装服务端部分:
43
- ```shell
44
- pip install satori-python-server
45
- ```
46
-
47
- ## 使用
48
-
49
- 客户端:
50
-
51
- ```python
52
- from satori import EventType, WebsocketsInfo
53
- from satori.event import MessageEvent
54
- from satori.client import Account, App
55
-
56
- app = App(WebsocketsInfo(port=5140))
57
-
58
- @app.register_on(EventType.MESSAGE_CREATED)
59
- async def on_message(account: Account, event: MessageEvent):
60
- if event.user.id == "xxxxxxxxxxx":
61
- await account.send(event, "Hello, World!")
62
-
63
- app.run()
64
- ```
65
-
66
- 服务端:
67
-
68
- ```python
69
- from satori import Api
70
- from satori.server import Server
71
-
72
- server = Server(port=5140)
73
-
74
- @server.route(Api.MESSAGE_CREATE)
75
- async def on_message_create(*args, **kwargs):
76
- return [{"id": "1234", "content": "example"}]
77
-
78
- server.run()
79
- ```
80
-
81
- ## 文档
82
-
83
- 请阅读 [仓库文档](./docs.md)
84
-
85
- ## 示例
86
-
87
- - 客户端:[client.py](./example/client.py)
88
- - 服务端:[server.py](./example/server.py)
89
- - 服务端(使用适配器):[server_with_adapter.py](./example/server_with_adapter.py)
90
- - 客户端(webhook):[client_webhook](./example/client_webhook.py)
91
- - 服务端(webhook):[server_webhook](./example/server_webhook.py)
92
- - 适配器:[adapter.py](./example/adapter.py)
93
-
94
- ## 架构
95
-
96
- ```mermaid
97
- graph LR
98
- subgraph Server
99
- server -- run --> asgi
100
- server -- register --> router -- mount --> asgi
101
- server -- apply --> provider -- mount --> asgi
102
- provider -- event,logins --> server
103
- end
104
- subgraph Client
105
- config -- apply --> app -- run --> network
106
- app -- register --> listener
107
- network -- account,event --> listener
108
- listener -- handle --> account -- session --> api
109
- end
110
-
111
- api -- request --> asgi -- response --> api
112
- server -- raw-event --> asgi -- websocket/webhook --> network
113
- ```
1
+ # satori-python
2
+
3
+ ![latest release](https://img.shields.io/github/release/RF-Tar-Railt/satori-python)
4
+ [![Licence](https://img.shields.io/github/license/RF-Tar-Railt/satori-python)](https://github.com/RF-Tar-Railt/satori-python/blob/main/LICENSE)
5
+ [![PyPI](https://img.shields.io/pypi/v/satori-python)](https://pypi.org/project/satori-python)
6
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/satori-python)](https://www.python.org/)
7
+
8
+ 基于 [Satori](https://satori.js.org/zh-CN/) 协议的 Python 开发工具包
9
+
10
+ ## 协议介绍
11
+
12
+ [Satori Protocol](https://satori.js.org/zh-CN/)
13
+
14
+ ### 协议端
15
+
16
+ 目前提供了 `satori` 协议实现的有:
17
+
18
+ - [Chronocat](https://chronocat.vercel.app)
19
+ - Koishi (搭配 `@koishijs/plugin-server`)
20
+
21
+ ### 使用该 SDK 的框架
22
+
23
+ - [`Entari`](https://github.com/ArcletProject/Entari)
24
+
25
+ ## 安装
26
+
27
+ 安装完整体:
28
+ ```shell
29
+ pip install satori-python
30
+ ```
31
+
32
+ 只安装基础部分:
33
+ ```shell
34
+ pip install satori-python-core
35
+ ```
36
+
37
+ 只安装客户端部分:
38
+ ```shell
39
+ pip install satori-python-client
40
+ ```
41
+
42
+ 只安装服务端部分:
43
+ ```shell
44
+ pip install satori-python-server
45
+ ```
46
+
47
+ ## 使用
48
+
49
+ 客户端:
50
+
51
+ ```python
52
+ from satori import EventType, WebsocketsInfo
53
+ from satori.event import MessageEvent
54
+ from satori.client import Account, App
55
+
56
+ app = App(WebsocketsInfo(port=5140))
57
+
58
+ @app.register_on(EventType.MESSAGE_CREATED)
59
+ async def on_message(account: Account, event: MessageEvent):
60
+ if event.user.id == "xxxxxxxxxxx":
61
+ await account.send(event, "Hello, World!")
62
+
63
+ app.run()
64
+ ```
65
+
66
+ 服务端:
67
+
68
+ ```python
69
+ from satori import Api
70
+ from satori.server import Server
71
+
72
+ server = Server(port=5140)
73
+
74
+ @server.route(Api.MESSAGE_CREATE)
75
+ async def on_message_create(*args, **kwargs):
76
+ return [{"id": "1234", "content": "example"}]
77
+
78
+ server.run()
79
+ ```
80
+
81
+ ## 文档
82
+
83
+ 请阅读 [仓库文档](./docs.md)
84
+
85
+ ## 示例
86
+
87
+ - 客户端:[client.py](./example/client.py)
88
+ - 服务端:[server.py](./example/server.py)
89
+ - 服务端(使用适配器):[server_with_adapter.py](./example/server_with_adapter.py)
90
+ - 客户端(webhook):[client_webhook](./example/client_webhook.py)
91
+ - 服务端(webhook):[server_webhook](./example/server_webhook.py)
92
+ - 适配器:[adapter.py](./example/adapter.py)
93
+
94
+ ## 架构
95
+
96
+ ```mermaid
97
+ graph LR
98
+ subgraph Server
99
+ server -- run --> asgi
100
+ server -- register --> router -- mount --> asgi
101
+ server -- apply --> provider -- mount --> asgi
102
+ provider -- event,logins --> server
103
+ end
104
+ subgraph Client
105
+ config -- apply --> app -- run --> network
106
+ app -- register --> listener
107
+ network -- account,event --> listener
108
+ listener -- handle --> account -- session --> api
109
+ end
110
+
111
+ api -- request --> asgi -- response --> api
112
+ server -- raw-event --> asgi -- websocket/webhook --> network
113
+ ```
@@ -29,7 +29,7 @@ classifiers = [
29
29
  "Programming Language :: Python :: 3.12",
30
30
  "Operating System :: OS Independent",
31
31
  ]
32
- version = "0.14.4"
32
+ version = "0.14.5"
33
33
 
34
34
  [project.license]
35
35
  text = "MIT"
@@ -1,46 +1,46 @@
1
- from .config import WebhookInfo as WebhookInfo
2
- from .config import WebsocketsInfo as WebsocketsInfo
3
- from .const import Api as Api
4
- from .const import EventType as EventType
5
- from .element import At as At
6
- from .element import Audio as Audio
7
- from .element import Author as Author
8
- from .element import Bold as Bold
9
- from .element import Button as Button
10
- from .element import Code as Code
11
- from .element import E as E
12
- from .element import Element as Element
13
- from .element import File as File
14
- from .element import Image as Image
15
- from .element import Italic as Italic
16
- from .element import Link as Link
17
- from .element import Message as Message
18
- from .element import Paragraph as Paragraph
19
- from .element import Quote as Quote
20
- from .element import Sharp as Sharp
21
- from .element import Spoiler as Spoiler
22
- from .element import Strikethrough as Strikethrough
23
- from .element import Subscript as Subscript
24
- from .element import Superscript as Superscript
25
- from .element import Text as Text
26
- from .element import Underline as Underline
27
- from .element import Video as Video
28
- from .element import select as select
29
- from .element import transform as transform
30
- from .model import ArgvInteraction as ArgvInteraction
31
- from .model import ButtonInteraction as ButtonInteraction
32
- from .model import Channel as Channel
33
- from .model import ChannelType as ChannelType
34
- from .model import Event as Event
35
- from .model import Guild as Guild
36
- from .model import Login as Login
37
- from .model import LoginStatus as LoginStatus
38
- from .model import Member as Member
39
- from .model import MessageObject as MessageObject
40
- from .model import PageDequeResult as PageDequeResult
41
- from .model import PageResult as PageResult
42
- from .model import Role as Role
43
- from .model import Upload as Upload
44
- from .model import User as User
45
-
46
- __version__ = "0.14.4"
1
+ from .config import WebhookInfo as WebhookInfo
2
+ from .config import WebsocketsInfo as WebsocketsInfo
3
+ from .const import Api as Api
4
+ from .const import EventType as EventType
5
+ from .element import At as At
6
+ from .element import Audio as Audio
7
+ from .element import Author as Author
8
+ from .element import Bold as Bold
9
+ from .element import Button as Button
10
+ from .element import Code as Code
11
+ from .element import E as E
12
+ from .element import Element as Element
13
+ from .element import File as File
14
+ from .element import Image as Image
15
+ from .element import Italic as Italic
16
+ from .element import Link as Link
17
+ from .element import Message as Message
18
+ from .element import Paragraph as Paragraph
19
+ from .element import Quote as Quote
20
+ from .element import Sharp as Sharp
21
+ from .element import Spoiler as Spoiler
22
+ from .element import Strikethrough as Strikethrough
23
+ from .element import Subscript as Subscript
24
+ from .element import Superscript as Superscript
25
+ from .element import Text as Text
26
+ from .element import Underline as Underline
27
+ from .element import Video as Video
28
+ from .element import select as select
29
+ from .element import transform as transform
30
+ from .model import ArgvInteraction as ArgvInteraction
31
+ from .model import ButtonInteraction as ButtonInteraction
32
+ from .model import Channel as Channel
33
+ from .model import ChannelType as ChannelType
34
+ from .model import Event as Event
35
+ from .model import Guild as Guild
36
+ from .model import Login as Login
37
+ from .model import LoginStatus as LoginStatus
38
+ from .model import Member as Member
39
+ from .model import MessageObject as MessageObject
40
+ from .model import PageDequeResult as PageDequeResult
41
+ from .model import PageResult as PageResult
42
+ from .model import Role as Role
43
+ from .model import Upload as Upload
44
+ from .model import User as User
45
+
46
+ __version__ = "0.14.5"