satori-python-server 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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: satori-python-server
3
- Version: 0.17.5
3
+ Version: 0.17.7
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>
@@ -20,7 +20,7 @@ Requires-Python: <4.0,>=3.10
20
20
  Requires-Dist: aiohttp>=3.9.3
21
21
  Requires-Dist: launart>=0.8.2
22
22
  Requires-Dist: graia-amnesia[uvicorn]<0.12.0,>=0.11.0
23
- Requires-Dist: starlette[python-multipart]>=0.37.2
23
+ Requires-Dist: starlette>=0.40.0
24
24
  Requires-Dist: websockets>=15.0.1
25
25
  Requires-Dist: python-multipart>=0.0.9
26
26
  Requires-Dist: satori-python-core>=0.17.0
@@ -8,7 +8,7 @@ dependencies = [
8
8
  "aiohttp>=3.9.3",
9
9
  "launart>=0.8.2",
10
10
  "graia-amnesia[uvicorn]<0.12.0,>=0.11.0",
11
- "starlette[python-multipart]>=0.37.2",
11
+ "starlette>=0.40.0",
12
12
  "websockets>=15.0.1",
13
13
  "python-multipart>=0.0.9",
14
14
  "satori-python-core >= 0.17.0",
@@ -27,7 +27,7 @@ classifiers = [
27
27
  "Programming Language :: Python :: 3.12",
28
28
  "Operating System :: OS Independent",
29
29
  ]
30
- version = "0.17.5"
30
+ version = "0.17.7"
31
31
 
32
32
  [project.license]
33
33
  text = "MIT"
@@ -53,7 +53,7 @@ dev = [
53
53
  "mina-build<0.6,>=0.5.1",
54
54
  "pdm-mina>=0.3.2",
55
55
  "nonechat<0.7.0,>=0.6.0",
56
- "uvicorn[standard]>=0.35.0",
56
+ "uvicorn[standard]>=0.37.0",
57
57
  ]
58
58
 
59
59
  [tool.pdm.build]
@@ -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