satori-python-server 0.14.3__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.
@@ -1,36 +1,36 @@
1
- includes = ["src/satori/server"]
2
- raw-dependencies = ["satori-python-core >= 0.11.4"]
3
-
4
- [project]
5
- name = "satori-python-server"
6
- dynamic = ["version"]
7
- authors = [
8
- {name = "RF-Tar-Railt", email = "rf_tar_railt@qq.com"}
9
- ]
10
- dependencies = [
11
- "aiohttp",
12
- "launart",
13
- "graia-amnesia",
14
- "starlette",
15
- "uvicorn[standard]",
16
- "python-multipart",
17
- ]
18
- description = "Satori Protocol SDK for python, specify server part"
19
- license = {text = "MIT"}
20
- readme = "README.md"
21
- requires-python = ">=3.8"
22
- classifiers = [
23
- "Typing :: Typed",
24
- "Development Status :: 4 - Beta",
25
- "License :: OSI Approved :: MIT License",
26
- "Programming Language :: Python :: 3.8",
27
- "Programming Language :: Python :: 3.9",
28
- "Programming Language :: Python :: 3.10",
29
- "Programming Language :: Python :: 3.11",
30
- "Programming Language :: Python :: 3.12",
31
- "Operating System :: OS Independent",
32
- ]
33
-
34
- [project.urls]
35
- homepage = "https://github.com/RF-Tar-Railt/satori-python"
36
- repository = "https://github.com/RF-Tar-Railt/satori-python"
1
+ includes = ["src/satori/server"]
2
+ raw-dependencies = ["satori-python-core >= 0.11.4"]
3
+
4
+ [project]
5
+ name = "satori-python-server"
6
+ dynamic = ["version"]
7
+ authors = [
8
+ {name = "RF-Tar-Railt", email = "rf_tar_railt@qq.com"}
9
+ ]
10
+ dependencies = [
11
+ "aiohttp",
12
+ "launart",
13
+ "graia-amnesia",
14
+ "starlette",
15
+ "uvicorn[standard]",
16
+ "python-multipart",
17
+ ]
18
+ description = "Satori Protocol SDK for python, specify server part"
19
+ license = {text = "MIT"}
20
+ readme = "README.md"
21
+ requires-python = ">=3.8"
22
+ classifiers = [
23
+ "Typing :: Typed",
24
+ "Development Status :: 4 - Beta",
25
+ "License :: OSI Approved :: MIT License",
26
+ "Programming Language :: Python :: 3.8",
27
+ "Programming Language :: Python :: 3.9",
28
+ "Programming Language :: Python :: 3.10",
29
+ "Programming Language :: Python :: 3.11",
30
+ "Programming Language :: Python :: 3.12",
31
+ "Operating System :: OS Independent",
32
+ ]
33
+
34
+ [project.urls]
35
+ homepage = "https://github.com/RF-Tar-Railt/satori-python"
36
+ repository = "https://github.com/RF-Tar-Railt/satori-python"
@@ -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-server
3
- Version: 0.14.3
3
+ Version: 0.14.5
4
4
  Summary: Satori Protocol SDK for python, specify server part
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
+ ```
@@ -27,7 +27,7 @@ classifiers = [
27
27
  "Programming Language :: Python :: 3.12",
28
28
  "Operating System :: OS Independent",
29
29
  ]
30
- version = "0.14.3"
30
+ version = "0.14.5"
31
31
 
32
32
  [project.license]
33
33
  text = "MIT"