satori-python-client 0.17.0__tar.gz → 0.17.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.
- {satori_python_client-0.17.0 → satori_python_client-0.17.2}/.mina/client.toml +4 -2
- {satori_python_client-0.17.0 → satori_python_client-0.17.2}/PKG-INFO +2 -2
- {satori_python_client-0.17.0 → satori_python_client-0.17.2}/pyproject.toml +2 -2
- {satori_python_client-0.17.0 → satori_python_client-0.17.2}/src/satori/client/__init__.py +4 -4
- {satori_python_client-0.17.0 → satori_python_client-0.17.2}/src/satori/client/account.py +4 -3
- {satori_python_client-0.17.0 → satori_python_client-0.17.2}/src/satori/client/account.pyi +4 -3
- {satori_python_client-0.17.0 → satori_python_client-0.17.2}/src/satori/client/network/webhook.py +3 -3
- {satori_python_client-0.17.0 → satori_python_client-0.17.2}/src/satori/client/network/websocket.py +7 -7
- {satori_python_client-0.17.0 → satori_python_client-0.17.2}/LICENSE +0 -0
- {satori_python_client-0.17.0 → satori_python_client-0.17.2}/README.md +0 -0
- {satori_python_client-0.17.0 → satori_python_client-0.17.2}/src/satori/client/config.py +0 -0
- {satori_python_client-0.17.0 → satori_python_client-0.17.2}/src/satori/client/network/__init__.py +0 -0
- {satori_python_client-0.17.0 → satori_python_client-0.17.2}/src/satori/client/network/base.py +0 -0
- {satori_python_client-0.17.0 → satori_python_client-0.17.2}/src/satori/client/network/util.py +0 -0
- {satori_python_client-0.17.0 → satori_python_client-0.17.2}/src/satori/client/protocol.py +0 -0
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
includes = ["src/satori/client"]
|
|
2
|
-
raw-dependencies = [
|
|
2
|
+
raw-dependencies = [
|
|
3
|
+
"satori-python-core >= 0.17.0",
|
|
4
|
+
"graia-amnesia >= 0.11.0",
|
|
5
|
+
]
|
|
3
6
|
|
|
4
7
|
[project]
|
|
5
8
|
name = "satori-python-client"
|
|
@@ -10,7 +13,6 @@ authors = [
|
|
|
10
13
|
dependencies = [
|
|
11
14
|
"aiohttp",
|
|
12
15
|
"launart",
|
|
13
|
-
"graia-amnesia",
|
|
14
16
|
]
|
|
15
17
|
description = "Satori Protocol SDK for python, specify client part"
|
|
16
18
|
license = {text = "MIT"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: satori-python-client
|
|
3
|
-
Version: 0.17.
|
|
3
|
+
Version: 0.17.2
|
|
4
4
|
Summary: Satori Protocol SDK for python, specify client 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>
|
|
@@ -19,8 +19,8 @@ Project-URL: Repository, https://github.com/RF-Tar-Railt/satori-python
|
|
|
19
19
|
Requires-Python: <4.0,>=3.10
|
|
20
20
|
Requires-Dist: aiohttp>=3.9.3
|
|
21
21
|
Requires-Dist: launart>=0.8.2
|
|
22
|
-
Requires-Dist: graia-amnesia[uvicorn]<0.12.0,>=0.11.0
|
|
23
22
|
Requires-Dist: satori-python-core>=0.17.0
|
|
23
|
+
Requires-Dist: graia-amnesia>=0.11.0
|
|
24
24
|
Description-Content-Type: text/markdown
|
|
25
25
|
|
|
26
26
|
# satori-python
|
|
@@ -7,8 +7,8 @@ authors = [
|
|
|
7
7
|
dependencies = [
|
|
8
8
|
"aiohttp>=3.9.3",
|
|
9
9
|
"launart>=0.8.2",
|
|
10
|
-
"graia-amnesia[uvicorn]<0.12.0,>=0.11.0",
|
|
11
10
|
"satori-python-core >= 0.17.0",
|
|
11
|
+
"graia-amnesia >= 0.11.0",
|
|
12
12
|
]
|
|
13
13
|
description = "Satori Protocol SDK for python, specify client part"
|
|
14
14
|
readme = "README.md"
|
|
@@ -24,7 +24,7 @@ classifiers = [
|
|
|
24
24
|
"Programming Language :: Python :: 3.12",
|
|
25
25
|
"Operating System :: OS Independent",
|
|
26
26
|
]
|
|
27
|
-
version = "0.17.
|
|
27
|
+
version = "0.17.2"
|
|
28
28
|
|
|
29
29
|
[project.license]
|
|
30
30
|
text = "MIT"
|
|
@@ -213,7 +213,7 @@ class App(Service):
|
|
|
213
213
|
if not login.user:
|
|
214
214
|
logger.warning(f"Received login-added event without user info: {login}")
|
|
215
215
|
return
|
|
216
|
-
login_sn = f"{login.user.id}@{id(conn)}"
|
|
216
|
+
login_sn = f"{login.user.id}@{id(conn):x}"
|
|
217
217
|
account = Account(
|
|
218
218
|
login,
|
|
219
219
|
conn.config,
|
|
@@ -232,7 +232,7 @@ class App(Service):
|
|
|
232
232
|
if not login.user:
|
|
233
233
|
logger.warning(f"Received login-updated event without user info: {login}")
|
|
234
234
|
return
|
|
235
|
-
login_sn = f"{login.user.id}@{id(conn)}"
|
|
235
|
+
login_sn = f"{login.user.id}@{id(conn):x}"
|
|
236
236
|
if login_sn not in self.accounts:
|
|
237
237
|
if login.status == LoginStatus.ONLINE:
|
|
238
238
|
account = Account(
|
|
@@ -266,13 +266,13 @@ class App(Service):
|
|
|
266
266
|
if not login.user:
|
|
267
267
|
logger.warning(f"Received login-removed event without user info: {login}")
|
|
268
268
|
return
|
|
269
|
-
login_sn = f"{login.user.id}@{id(conn)}"
|
|
269
|
+
login_sn = f"{login.user.id}@{id(conn):x}"
|
|
270
270
|
if login_sn not in self.accounts:
|
|
271
271
|
logger.warning(f"Received event for unknown account: {event}")
|
|
272
272
|
return
|
|
273
273
|
account = self.accounts[login_sn]
|
|
274
274
|
else:
|
|
275
|
-
login_sn = f"{event.login.user.id}@{id(conn)}"
|
|
275
|
+
login_sn = f"{event.login.user.id}@{id(conn):x}"
|
|
276
276
|
if login_sn not in self.accounts:
|
|
277
277
|
logger.warning(f"Received event for unknown account: {event}")
|
|
278
278
|
return
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import asyncio
|
|
4
|
-
from dataclasses import dataclass
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
5
|
from typing_extensions import Generic, TypeVar # noqa: UP035
|
|
6
6
|
|
|
7
7
|
from yarl import URL
|
|
@@ -10,8 +10,8 @@ from satori.model import Login
|
|
|
10
10
|
|
|
11
11
|
from .protocol import ApiProtocol
|
|
12
12
|
|
|
13
|
-
TP = TypeVar("TP", bound="ApiProtocol", default=ApiProtocol)
|
|
14
|
-
TP1 = TypeVar("TP1", bound="ApiProtocol", default=ApiProtocol)
|
|
13
|
+
TP = TypeVar("TP", bound="ApiProtocol", default=ApiProtocol, covariant=True)
|
|
14
|
+
TP1 = TypeVar("TP1", bound="ApiProtocol", default=ApiProtocol, covariant=True)
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
@dataclass
|
|
@@ -21,6 +21,7 @@ class ApiInfo:
|
|
|
21
21
|
path: str = ""
|
|
22
22
|
token: str | None = None
|
|
23
23
|
timeout: float | None = None
|
|
24
|
+
api_base: URL = field(init=False)
|
|
24
25
|
|
|
25
26
|
def __post_init__(self):
|
|
26
27
|
if self.path and not self.path.startswith("/"):
|
|
@@ -26,8 +26,8 @@ from satori.model import (
|
|
|
26
26
|
|
|
27
27
|
from .protocol import ApiProtocol
|
|
28
28
|
|
|
29
|
-
TP = TypeVar("TP", bound="ApiProtocol", default=ApiProtocol)
|
|
30
|
-
TP1 = TypeVar("TP1", bound="ApiProtocol", default=ApiProtocol)
|
|
29
|
+
TP = TypeVar("TP", bound="ApiProtocol", default=ApiProtocol, covariant=True)
|
|
30
|
+
TP1 = TypeVar("TP1", bound="ApiProtocol", default=ApiProtocol, covariant=True)
|
|
31
31
|
|
|
32
32
|
class Api(Protocol):
|
|
33
33
|
token: str | None = None
|
|
@@ -42,7 +42,8 @@ class ApiInfo(Api):
|
|
|
42
42
|
path: str = "",
|
|
43
43
|
token: str | None = None,
|
|
44
44
|
timeout: float | None = None,
|
|
45
|
-
):
|
|
45
|
+
):
|
|
46
|
+
self.api_base: URL = ...
|
|
46
47
|
|
|
47
48
|
class Account(Generic[TP]):
|
|
48
49
|
adapter: str
|
{satori_python_client-0.17.0 → satori_python_client-0.17.2}/src/satori/client/network/webhook.py
RENAMED
|
@@ -23,7 +23,7 @@ class WebhookNetwork(BaseNetwork[WebhookInfo]):
|
|
|
23
23
|
|
|
24
24
|
@property
|
|
25
25
|
def id(self):
|
|
26
|
-
return f"satori/
|
|
26
|
+
return f"satori/net/wh/{self.config.identity}#{id(self):x}"
|
|
27
27
|
|
|
28
28
|
async def handle_request(self, req: web.Request):
|
|
29
29
|
header = req.headers
|
|
@@ -105,7 +105,7 @@ class WebhookNetwork(BaseNetwork[WebhookInfo]):
|
|
|
105
105
|
for login in meta.logins:
|
|
106
106
|
if not login.user:
|
|
107
107
|
continue
|
|
108
|
-
login_sn = f"{login.user.id}@{id(self)}"
|
|
108
|
+
login_sn = f"{login.user.id}@{id(self):x}"
|
|
109
109
|
account = Account(login, self.config, meta.proxy_urls, self.app.default_api_cls)
|
|
110
110
|
logger.info(f"account registered: {account}")
|
|
111
111
|
(account.connected.set() if login.status == LoginStatus.ONLINE else account.connected.clear())
|
|
@@ -117,7 +117,7 @@ class WebhookNetwork(BaseNetwork[WebhookInfo]):
|
|
|
117
117
|
logger.info(f"{self.id} Webhook server exiting...")
|
|
118
118
|
self.close_signal.set()
|
|
119
119
|
for v in list(self.app.accounts.values()):
|
|
120
|
-
if (identity := f"{v.self_id}@{id(self)}") in self.accounts:
|
|
120
|
+
if (identity := f"{v.self_id}@{id(self):x}") in self.accounts:
|
|
121
121
|
v.connected.clear()
|
|
122
122
|
await self.app.account_update(v, LoginStatus.OFFLINE)
|
|
123
123
|
del self.app.accounts[identity]
|
{satori_python_client-0.17.0 → satori_python_client-0.17.2}/src/satori/client/network/websocket.py
RENAMED
|
@@ -23,7 +23,7 @@ class WsNetwork(BaseNetwork[WebsocketsInfo]):
|
|
|
23
23
|
|
|
24
24
|
@property
|
|
25
25
|
def id(self):
|
|
26
|
-
return f"satori/
|
|
26
|
+
return f"satori/net/ws/{self.config.identity}#{id(self):x}"
|
|
27
27
|
|
|
28
28
|
connection: aiohttp.ClientWebSocketResponse | None = None
|
|
29
29
|
|
|
@@ -107,7 +107,7 @@ class WsNetwork(BaseNetwork[WebsocketsInfo]):
|
|
|
107
107
|
for login in ready.logins:
|
|
108
108
|
if not login.user:
|
|
109
109
|
continue
|
|
110
|
-
login_sn = f"{login.user.id}@{id(self)}"
|
|
110
|
+
login_sn = f"{login.user.id}@{id(self):x}"
|
|
111
111
|
if login_sn in self.app.accounts:
|
|
112
112
|
account = self.app.accounts[login_sn]
|
|
113
113
|
self.accounts[login_sn] = account
|
|
@@ -162,7 +162,7 @@ class WsNetwork(BaseNetwork[WebsocketsInfo]):
|
|
|
162
162
|
self.close_signal.set()
|
|
163
163
|
self.connection = None
|
|
164
164
|
for v in list(self.app.accounts.values()):
|
|
165
|
-
if (identity := f"{v.self_id}@{id(self)}") in self.accounts:
|
|
165
|
+
if (identity := f"{v.self_id}@{id(self):x}") in self.accounts:
|
|
166
166
|
v.connected.clear()
|
|
167
167
|
await self.app.account_update(v, LoginStatus.OFFLINE)
|
|
168
168
|
del self.app.accounts[identity]
|
|
@@ -170,7 +170,7 @@ class WsNetwork(BaseNetwork[WebsocketsInfo]):
|
|
|
170
170
|
return
|
|
171
171
|
if close_task in done:
|
|
172
172
|
receiver_task.cancel()
|
|
173
|
-
logger.warning(f"{self} Connection closed by server, will reconnect in 5 seconds...")
|
|
173
|
+
logger.warning(f"{self.id} Connection closed by server, will reconnect in 5 seconds...")
|
|
174
174
|
for k in self.accounts.keys():
|
|
175
175
|
logger.debug(f"Unregistering satori account {k}...")
|
|
176
176
|
account = self.app.accounts[k]
|
|
@@ -178,12 +178,12 @@ class WsNetwork(BaseNetwork[WebsocketsInfo]):
|
|
|
178
178
|
await self.app.account_update(account, LoginStatus.RECONNECT)
|
|
179
179
|
self.accounts.clear()
|
|
180
180
|
await asyncio.sleep(5)
|
|
181
|
-
logger.info(f"{self} Reconnecting...")
|
|
181
|
+
logger.info(f"{self.id} Reconnecting...")
|
|
182
182
|
continue
|
|
183
183
|
except Exception as e:
|
|
184
|
-
logger.error(f"{self} Error while connecting: {e}")
|
|
184
|
+
logger.error(f"{self.id} Error while connecting: {e}")
|
|
185
185
|
await asyncio.sleep(5)
|
|
186
|
-
logger.info(f"{self} Reconnecting...")
|
|
186
|
+
logger.info(f"{self.id} Reconnecting...")
|
|
187
187
|
|
|
188
188
|
async def launch(self, manager: Launart):
|
|
189
189
|
async with self.stage("preparing"):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{satori_python_client-0.17.0 → satori_python_client-0.17.2}/src/satori/client/network/__init__.py
RENAMED
|
File without changes
|
{satori_python_client-0.17.0 → satori_python_client-0.17.2}/src/satori/client/network/base.py
RENAMED
|
File without changes
|
{satori_python_client-0.17.0 → satori_python_client-0.17.2}/src/satori/client/network/util.py
RENAMED
|
File without changes
|
|
File without changes
|