160-tool MCP server for real-time global intelligence from free public APIs: markets, liquidity, prediction markets, SEC filings, conflict, military, aircraft-cohort early warning, migration and border flows, cyber, climate, news and more. Dated observation history, 29 research prompts, cited briefs, geofences, SSE dashboard. MIT, no paid API keys.
Python ai-toolsai-watchanthropicclaudecybersecuritydashboardgeofencinggeopoliticalgeospatialintelligencemarketsmcpmigrationmilitarymodel-context-protocolnuclearosintreal-timespace-weatherthreat-intelligence
Fetcher: accept_404 is keyword-only
Phoenix Agent (mac-studio)8dba753dfd38
diff --git a/src/world_intel_mcp/fetcher.py b/src/world_intel_mcp/fetcher.pyindex e71a534..042e425 100644--- a/src/world_intel_mcp/fetcher.py+++ b/src/world_intel_mcp/fetcher.py@@ -279,6 +279,7 @@ class Fetcher:headers: dict[str, str] | None = None,timeout: float | None = None,max_bytes: int = 256 * 1024 * 1024,+ *,accept_404: Callable[[bytes], bool] | None = None,) -> BinaryResult:"""Fetch a binary body with rate limiting, retries and circuit breaking.diff --git a/src/world_intel_mcp/tests/test_fetcher_accept_404.py b/src/world_intel_mcp/tests/test_fetcher_accept_404.pyindex 7fd81dc..cafff83 100644--- a/src/world_intel_mcp/tests/test_fetcher_accept_404.py+++ b/src/world_intel_mcp/tests/test_fetcher_accept_404.py@@ -2,15 +2,17 @@A 404 is normally a definitive answer: not retried, not a sourcefailure. An API that answers "no data" with a 404 of a known shape can-pass ``accept_404``, a predicate on the 404 body: a 404 it accepts stays-a definitive answer, a 404 it rejects (an error page from a proxy in-front of the API) is retried and counted as a failure like any other-HTTP error status. Callers that pass no predicate are unaffected.+pass ``accept_404`` (keyword-only), a predicate on the 404 body: a 404+it accepts stays a definitive answer, a 404 it rejects (an error page+from a proxy in front of the API) is retried and counted as a failure+like any other HTTP error status. Callers that pass no predicate are+unaffected.Gaps / not covered: a predicate that raises (the contract says it mustnot); get_text, get_json and get_xml have no such option."""+import inspectfrom unittest.mock import AsyncMockimport httpx@@ -146,3 +148,16 @@ async def test_the_predicate_is_consulted_only_for_404(fetcher: Fetcher, sleep:assert calls == []assert result.status == statusassert result.ok is (status == 200)+++async def test_accept_404_is_keyword_only(fetcher: Fetcher, sleep: AsyncMock) -> None:+ """A parameter another change adds after max_bytes can never be bound+ to the predicate by position, nor the predicate to it."""+ route = respx.get(_URL).mock(return_value=httpx.Response(404, content=_HTML_404))+ param = inspect.signature(Fetcher.get_bytes).parameters["accept_404"]+ assert param.kind is inspect.Parameter.KEYWORD_ONLY and param.default is None++ with pytest.raises(TypeError):+ await fetcher.get_bytes(_URL, "t", None, None, 1024, _json_object)+ assert route.call_count == 0