satori-python 0.17.5__tar.gz → 0.17.7__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 (30) hide show
  1. {satori_python-0.17.5 → satori_python-0.17.7}/PKG-INFO +2 -2
  2. {satori_python-0.17.5 → satori_python-0.17.7}/pyproject.toml +3 -3
  3. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/__init__.py +1 -1
  4. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/client/__init__.py +7 -1
  5. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/element.py +1 -1
  6. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/server/__init__.py +10 -5
  7. {satori_python-0.17.5 → satori_python-0.17.7}/LICENSE +0 -0
  8. {satori_python-0.17.5 → satori_python-0.17.7}/README.md +0 -0
  9. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/_vendor/fleep.py +0 -0
  10. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/client/account.py +0 -0
  11. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/client/account.pyi +0 -0
  12. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/client/config.py +0 -0
  13. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/client/network/__init__.py +0 -0
  14. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/client/network/base.py +0 -0
  15. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/client/network/util.py +0 -0
  16. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/client/network/webhook.py +0 -0
  17. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/client/network/websocket.py +0 -0
  18. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/client/protocol.py +0 -0
  19. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/const.py +0 -0
  20. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/event.py +0 -0
  21. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/exception.py +0 -0
  22. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/model.py +0 -0
  23. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/parser.py +0 -0
  24. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/server/adapter.py +0 -0
  25. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/server/connection.py +0 -0
  26. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/server/formdata.py +0 -0
  27. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/server/model.py +0 -0
  28. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/server/route.py +0 -0
  29. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/server/utils.py +0 -0
  30. {satori_python-0.17.5 → satori_python-0.17.7}/src/satori/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: satori-python
3
- Version: 0.17.5
3
+ Version: 0.17.7
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>
@@ -22,10 +22,10 @@ Requires-Dist: loguru>=0.7.2
22
22
  Requires-Dist: launart>=0.8.2
23
23
  Requires-Dist: typing-extensions>=4.7.0
24
24
  Requires-Dist: graia-amnesia[uvicorn]<0.12.0,>=0.11.0
25
- Requires-Dist: starlette[python-multipart]>=0.37.2
26
25
  Requires-Dist: yarl>=1.9.4
27
26
  Requires-Dist: python-multipart>=0.0.9
28
27
  Requires-Dist: websockets>=15.0.1
28
+ Requires-Dist: starlette>=0.40.0
29
29
  Requires-Dist: msgspec>=0.19.0; extra == "msgspec"
30
30
  Provides-Extra: msgspec
31
31
  Description-Content-Type: text/markdown
@@ -11,10 +11,10 @@ dependencies = [
11
11
  "launart>=0.8.2",
12
12
  "typing-extensions>=4.7.0",
13
13
  "graia-amnesia[uvicorn]<0.12.0,>=0.11.0",
14
- "starlette[python-multipart]>=0.37.2",
15
14
  "yarl>=1.9.4",
16
15
  "python-multipart>=0.0.9",
17
16
  "websockets>=15.0.1",
17
+ "starlette>=0.40.0",
18
18
  ]
19
19
  requires-python = ">=3.10,<4.0"
20
20
  readme = "README.md"
@@ -29,7 +29,7 @@ classifiers = [
29
29
  "Programming Language :: Python :: 3.12",
30
30
  "Operating System :: OS Independent",
31
31
  ]
32
- version = "0.17.5"
32
+ version = "0.17.7"
33
33
 
34
34
  [project.license]
35
35
  text = "MIT"
@@ -60,7 +60,7 @@ dev = [
60
60
  "mina-build<0.6,>=0.5.1",
61
61
  "pdm-mina>=0.3.2",
62
62
  "nonechat<0.7.0,>=0.6.0",
63
- "uvicorn[standard]>=0.35.0",
63
+ "uvicorn[standard]>=0.37.0",
64
64
  ]
65
65
 
66
66
  [tool.pdm.build]
@@ -42,4 +42,4 @@ from .model import Role as Role
42
42
  from .model import Upload as Upload
43
43
  from .model import User as User
44
44
 
45
- __version__ = "0.17.5"
45
+ __version__ = "0.17.7"
@@ -4,6 +4,7 @@ import asyncio
4
4
  import functools
5
5
  import signal
6
6
  import threading
7
+ import traceback
7
8
  from collections.abc import Awaitable, Callable, Iterable
8
9
  from functools import wraps
9
10
  from typing import TYPE_CHECKING, Any, Literal, TypeVar, overload
@@ -279,7 +280,12 @@ class App(Service):
279
280
  account = self.accounts[login_sn]
280
281
 
281
282
  if self.event_callbacks:
282
- await asyncio.gather(*(callback(account, event) for callback in self.event_callbacks))
283
+ task = asyncio.gather(*(callback(account, event) for callback in self.event_callbacks))
284
+ try:
285
+ await task
286
+ except Exception:
287
+ traceback.print_exc()
288
+ task.cancel()
283
289
 
284
290
  if event.type == EventType.LOGIN_REMOVED:
285
291
  logger.info(f"account removed: {account}")
@@ -217,7 +217,7 @@ class Resource(Element):
217
217
  if url is not None:
218
218
  data |= {"src": url}
219
219
  elif path:
220
- data |= {"src": Path(path).as_uri()}
220
+ data |= {"src": Path(path).resolve().as_uri()}
221
221
  elif raw:
222
222
  bd = raw.getvalue() if isinstance(raw, BytesIO) else raw
223
223
  if mime is None:
@@ -39,11 +39,10 @@ from starlette.types import ASGIApp
39
39
  from starlette.websockets import WebSocket, WebSocketDisconnect
40
40
  from yarl import URL
41
41
 
42
- from satori.const import Api
42
+ from satori.const import Api, EventType
43
43
  from satori.model import Event, Meta, ModelBase, Opcode
44
44
  from satori.utils import decode
45
45
 
46
- from .. import EventType
47
46
  from .adapter import Adapter as Adapter
48
47
  from .connection import WebsocketConnection
49
48
  from .formdata import parse_content_disposition as parse_content_disposition
@@ -84,11 +83,15 @@ async def _request_handler(action: str, request: StarletteRequest, func: RouteCa
84
83
  )
85
84
  return JSONResponse(content=res)
86
85
  try:
86
+ if request.method == "GET":
87
+ params = dict(request.query_params)
88
+ else:
89
+ params = await request.json()
87
90
  res = await func(
88
91
  Request(
89
92
  request,
90
93
  action,
91
- await request.json(),
94
+ params,
92
95
  platform=platform,
93
96
  self_id=self_id,
94
97
  )
@@ -329,7 +332,9 @@ class Server(Service, RouterMixin):
329
332
  else:
330
333
  continue
331
334
  return await _request_handler(action, request, func, platform, self_id)
332
- return Response(status_code=404, content=action)
335
+ return Response(
336
+ status_code=404, content=f"Action {action!r} is not supported in current platform {platform!r}."
337
+ )
333
338
 
334
339
  async def proxy_url_handler(self, request: StarletteRequest):
335
340
  url = request.path_params["internal_url"]
@@ -340,7 +345,7 @@ class Server(Service, RouterMixin):
340
345
  isinstance(resp, (PlainTextResponse, HTMLResponse, JSONResponse)) or resp.__class__ is Response
341
346
  ) and len(resp.body) > self.stream_threshold:
342
347
 
343
- async def iter_content(body: bytes):
348
+ async def iter_content(body: bytes | memoryview[int]):
344
349
  for i in range(0, len(body), self.stream_chunk_size):
345
350
  yield body[i : i + self.stream_chunk_size]
346
351
 
File without changes
File without changes