nocfo-cli 1.3.0__tar.gz → 1.4.0__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.
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/PKG-INFO +1 -1
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/pyproject.toml +1 -1
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/mcp/http_error_capture.py +18 -8
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/mcp/server.py +1 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/LICENSE +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/README.md +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/__init__.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/api_client.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/cli/__init__.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/cli/app.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/cli/commands/__init__.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/cli/commands/_helpers.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/cli/commands/accounts.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/cli/commands/auth.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/cli/commands/businesses.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/cli/commands/contacts.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/cli/commands/documents.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/cli/commands/files.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/cli/commands/invoices.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/cli/commands/products.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/cli/commands/purchase_invoices.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/cli/commands/reports.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/cli/commands/schema.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/cli/commands/tags.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/cli/commands/user.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/cli/context.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/cli/output.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/config.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/mcp/__init__.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/mcp/auth.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/mcp/contract_validation.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/mcp/error_handling.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/mcp/middleware.py +0 -0
- {nocfo_cli-1.3.0 → nocfo_cli-1.4.0}/src/nocfo_toolkit/openapi.py +0 -0
|
@@ -21,21 +21,31 @@ def get_last_http_error() -> dict[str, Any] | None:
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
async def capture_http_error_response(response: httpx.Response) -> None:
|
|
24
|
-
"""Store status/payload for the latest
|
|
24
|
+
"""Store status/payload for the latest HTTP response.
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
FastMCP can issue downstream requests with streaming enabled. In that mode,
|
|
27
|
+
accessing ``response.content``/``response.json`` without ``aread()`` raises
|
|
28
|
+
``ResponseNotRead``. We therefore always drain the body first, even for
|
|
29
|
+
success responses, so tool handlers can safely decode the payload.
|
|
30
|
+
"""
|
|
29
31
|
|
|
30
32
|
try:
|
|
31
33
|
await response.aread()
|
|
32
|
-
except httpx.HTTPError:
|
|
33
|
-
|
|
34
|
+
except (httpx.HTTPError, httpx.StreamError):
|
|
35
|
+
# Keep best-effort behavior: failures here should not shadow the original
|
|
36
|
+
# tool error path. The middleware still clears stale captured state below.
|
|
37
|
+
_LAST_HTTP_ERROR.set(None)
|
|
38
|
+
return
|
|
39
|
+
|
|
40
|
+
if response.status_code < 400:
|
|
41
|
+
_LAST_HTTP_ERROR.set(None)
|
|
42
|
+
return
|
|
34
43
|
|
|
35
44
|
try:
|
|
36
45
|
payload: Any = response.json() if response.content else None
|
|
37
|
-
except
|
|
38
|
-
|
|
46
|
+
except ValueError:
|
|
47
|
+
text = response.text.strip()
|
|
48
|
+
payload = text[:1000] if text else None
|
|
39
49
|
|
|
40
50
|
_LAST_HTTP_ERROR.set(
|
|
41
51
|
{
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|