turboapi 0.3.20__cp313-cp313-win_amd64.whl → 0.3.23__cp313-cp313-win_amd64.whl
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.
|
Binary file
|
turboapi/request_handler.py
CHANGED
|
@@ -191,43 +191,38 @@ def create_enhanced_handler(original_handler, route_definition):
|
|
|
191
191
|
# Filter kwargs to only pass expected parameters
|
|
192
192
|
filtered_kwargs = {
|
|
193
193
|
k: v for k, v in kwargs.items()
|
|
194
|
-
if k in sig.parameters
|
|
195
194
|
}
|
|
196
195
|
|
|
197
196
|
# Call original handler
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
loop = asyncio.get_event_loop()
|
|
203
|
-
except RuntimeError:
|
|
204
|
-
loop = asyncio.new_event_loop()
|
|
205
|
-
asyncio.set_event_loop(loop)
|
|
206
|
-
result = loop.run_until_complete(original_handler(**filtered_kwargs))
|
|
207
|
-
else:
|
|
208
|
-
result = original_handler(**filtered_kwargs)
|
|
197
|
+
# v0.3.21: Async handlers are now supported via Rust's tokio runtime!
|
|
198
|
+
# The Rust layer (server.rs) will detect coroutines and await them properly
|
|
199
|
+
# using pyo3-async-runtimes, giving us native async performance
|
|
200
|
+
result = original_handler(**filtered_kwargs)
|
|
209
201
|
|
|
210
|
-
#
|
|
211
|
-
|
|
202
|
+
# Check if result is a coroutine - if so, return it directly for Rust to await
|
|
203
|
+
import inspect
|
|
204
|
+
if inspect.iscoroutine(result):
|
|
205
|
+
# Return coroutine directly - Rust will await it using tokio
|
|
206
|
+
return result
|
|
212
207
|
|
|
213
|
-
return
|
|
208
|
+
# Sync result - normalize and return as JSON string
|
|
209
|
+
content, status_code = ResponseHandler.normalize_response(result)
|
|
214
210
|
|
|
211
|
+
# Return JSON string directly for Rust to use
|
|
212
|
+
import json
|
|
213
|
+
return json.dumps(content)
|
|
215
214
|
except ValueError as e:
|
|
216
215
|
# Validation or parsing error (400 Bad Request)
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
400
|
|
220
|
-
)
|
|
216
|
+
import json
|
|
217
|
+
return json.dumps({"error": "Bad Request", "detail": str(e)})
|
|
221
218
|
except Exception as e:
|
|
222
219
|
# Unexpected error (500 Internal Server Error)
|
|
223
220
|
import traceback
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
500
|
|
231
|
-
)
|
|
221
|
+
import json
|
|
222
|
+
return json.dumps({
|
|
223
|
+
"error": "Internal Server Error",
|
|
224
|
+
"detail": str(e),
|
|
225
|
+
"traceback": traceback.format_exc()
|
|
226
|
+
})
|
|
232
227
|
|
|
233
228
|
return enhanced_handler
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
turboapi-0.3.
|
|
2
|
-
turboapi-0.3.
|
|
1
|
+
turboapi-0.3.23.dist-info/METADATA,sha256=VpVhmCyvdoNHS9gk-eEOkUHBrew-Phst2zTKRamNGH4,1458
|
|
2
|
+
turboapi-0.3.23.dist-info/WHEEL,sha256=tA3jeK73gMv2hhaFxfSe9XAOJHRQ2Ol5rfMGxqHyYEk,96
|
|
3
3
|
turboapi/__init__.py,sha256=r9Fphtu9ruHFUhSpBMAGxY5en2wvcnsE1nMp2DDRM6w,692
|
|
4
4
|
turboapi/__pycache__/__init__.cpython-312.pyc,sha256=WGxT-5DbR5Q-z4xzZmEJQt71dI-ib_lgOs0KB8wJqX8,728
|
|
5
5
|
turboapi/__pycache__/__init__.cpython-313.pyc,sha256=WvwBnRja8h3Oj0Q1NMdIBm_M3fAp25eUD7dM9h0lbeM,675
|
|
@@ -20,14 +20,14 @@ turboapi/__pycache__/rust_integration.cpython-313.pyc,sha256=4vpl3q5yBszAV9y44Xx
|
|
|
20
20
|
turboapi/__pycache__/server_integration.cpython-313.pyc,sha256=wSqZ72Sh6iyWbIJsdfk8s9oDL9L3DJPJWnz41mDGxCY,20089
|
|
21
21
|
turboapi/__pycache__/version_check.cpython-312.pyc,sha256=xfdKv0_EU8gs3Ot1cDrQFJuuZYpEknwNEYzoTJzWk9g,9180
|
|
22
22
|
turboapi/__pycache__/version_check.cpython-313.pyc,sha256=xgmdzdAt31IIw15NZxhc6JZjDCpw2Kw8DXrWUhNvHqw,10364
|
|
23
|
-
turboapi/_rust.cp313-win_amd64.pyd,sha256=
|
|
23
|
+
turboapi/_rust.cp313-win_amd64.pyd,sha256=V6i3g1I6zquV8Rfk9SUsmOpuho7Y8WYBCkwfg7VZAhA,3465216
|
|
24
24
|
turboapi/decorators.py,sha256=jjJrIXZ3y_yJ231ar24hS09OCDtTqmYA7arpIOcr2kk,1788
|
|
25
25
|
turboapi/main_app.py,sha256=mR-x-RPJn96Jtg0a313hU_2UsLQNV_xNXRtpFYWAr30,9188
|
|
26
26
|
turboapi/middleware.py,sha256=kDRGblEWopPqROT2O4P4HhB87tGw73qfpLm1svjNs6U,2183
|
|
27
27
|
turboapi/models.py,sha256=VCU68f9MGtDdFb4crsx2e0SHghICg8zjU8OumfdpZLQ,5363
|
|
28
|
-
turboapi/request_handler.py,sha256=
|
|
28
|
+
turboapi/request_handler.py,sha256=lFKXPTjOAFdgKmuQhLV-mwVIZQU6wg-FkSYkASCC_tc,8643
|
|
29
29
|
turboapi/routing.py,sha256=iCbty56a2J9qnCtxIHQtYf66ZoKVxgISxwCxYvGmgEs,7746
|
|
30
30
|
turboapi/rust_integration.py,sha256=6fFhucDHku4r4mKX5dedz6MmPWTx2MxIq9M7H1xiyvo,14859
|
|
31
31
|
turboapi/server_integration.py,sha256=drUhhTasWgQfyhFiAaHKd987N3mnE0qkMab1ylmqd4c,18340
|
|
32
32
|
turboapi/version_check.py,sha256=z3O1vIJsWmG_DO271ayYWSwaDfgpFnfJzYRYyowKYMc,9625
|
|
33
|
-
turboapi-0.3.
|
|
33
|
+
turboapi-0.3.23.dist-info/RECORD,,
|
|
File without changes
|