satori-python-server 0.17.3__tar.gz → 0.17.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.
- {satori_python_server-0.17.3 → satori_python_server-0.17.5}/PKG-INFO +1 -1
- {satori_python_server-0.17.3 → satori_python_server-0.17.5}/pyproject.toml +2 -1
- {satori_python_server-0.17.3 → satori_python_server-0.17.5}/src/satori/server/__init__.py +14 -4
- {satori_python_server-0.17.3 → satori_python_server-0.17.5}/src/satori/server/adapter.py +5 -1
- {satori_python_server-0.17.3 → satori_python_server-0.17.5}/.mina/server.toml +0 -0
- {satori_python_server-0.17.3 → satori_python_server-0.17.5}/LICENSE +0 -0
- {satori_python_server-0.17.3 → satori_python_server-0.17.5}/README.md +0 -0
- {satori_python_server-0.17.3 → satori_python_server-0.17.5}/src/satori/server/connection.py +0 -0
- {satori_python_server-0.17.3 → satori_python_server-0.17.5}/src/satori/server/formdata.py +0 -0
- {satori_python_server-0.17.3 → satori_python_server-0.17.5}/src/satori/server/model.py +0 -0
- {satori_python_server-0.17.3 → satori_python_server-0.17.5}/src/satori/server/route.py +0 -0
- {satori_python_server-0.17.3 → satori_python_server-0.17.5}/src/satori/server/utils.py +0 -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.
|
|
30
|
+
version = "0.17.5"
|
|
31
31
|
|
|
32
32
|
[project.license]
|
|
33
33
|
text = "MIT"
|
|
@@ -96,6 +96,7 @@ exclude = [
|
|
|
96
96
|
"exam_qps.py",
|
|
97
97
|
"exam1.py",
|
|
98
98
|
"exam2.py",
|
|
99
|
+
"src/satori/_vendor/*",
|
|
99
100
|
]
|
|
100
101
|
|
|
101
102
|
[tool.ruff.lint]
|
|
@@ -308,17 +308,27 @@ class Server(Service, RouterMixin):
|
|
|
308
308
|
self_id: str = request.headers.get("X-Self-ID") or request.headers.get("Satori-User-ID") # type: ignore
|
|
309
309
|
|
|
310
310
|
for _router in self._adapters:
|
|
311
|
-
if action
|
|
311
|
+
if action in _router.routes:
|
|
312
|
+
func = _router.routes[action]
|
|
313
|
+
elif action.startswith("internal") and "internal/*" in _router.routes:
|
|
314
|
+
func = _router.routes["internal/*"]
|
|
315
|
+
else:
|
|
312
316
|
continue
|
|
313
317
|
if not _router.ensure(platform, self_id):
|
|
314
318
|
continue
|
|
315
|
-
return await _request_handler(action, request,
|
|
319
|
+
return await _request_handler(action, request, func, platform, self_id)
|
|
316
320
|
if action in self.routes:
|
|
317
321
|
return await _request_handler(action, request, self.routes[action], platform, self_id)
|
|
322
|
+
if action.startswith("internal") and "internal/*" in self.routes:
|
|
323
|
+
return await _request_handler(action, request, self.routes["internal/*"], platform, self_id)
|
|
318
324
|
for _router in self.routers:
|
|
319
|
-
if action
|
|
325
|
+
if action in _router.routes:
|
|
326
|
+
func = _router.routes[action]
|
|
327
|
+
elif action.startswith("internal") and "internal/*" in _router.routes:
|
|
328
|
+
func = _router.routes["internal/*"]
|
|
329
|
+
else:
|
|
320
330
|
continue
|
|
321
|
-
return await _request_handler(action, request,
|
|
331
|
+
return await _request_handler(action, request, func, platform, self_id)
|
|
322
332
|
return Response(status_code=404, content=action)
|
|
323
333
|
|
|
324
334
|
async def proxy_url_handler(self, request: StarletteRequest):
|
|
@@ -22,7 +22,11 @@ class Adapter(Service, RouterMixin):
|
|
|
22
22
|
server: "Server"
|
|
23
23
|
|
|
24
24
|
@abstractmethod
|
|
25
|
-
def get_platform(self) -> str:
|
|
25
|
+
def get_platform(self) -> str:
|
|
26
|
+
"""该方法仅用于自动标识适配器类型
|
|
27
|
+
|
|
28
|
+
若你继承该类并且重写了 `id`, 该方法可以返回任意字符串
|
|
29
|
+
"""
|
|
26
30
|
|
|
27
31
|
@abstractmethod
|
|
28
32
|
def ensure(self, platform: str, self_id: str) -> bool: ...
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|