MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / platform_client

Function platform_client

tests/lib/test_platform_resources.py:55–83  ·  view source on GitHub ↗
(platform: str, sync: bool, requests: list[httpx2.Request] | None = None)

Source from the content-addressed store, hash-verified

53
54
55def platform_client(platform: str, sync: bool, requests: list[httpx2.Request] | None = None) -> Any:
56 def respond(request: httpx2.Request) -> httpx2.Response:
57 if requests is not None:
58 requests.append(request)
59 return httpx2.Response(200, json=MESSAGE)
60
61 transport = httpx2.MockTransport(respond)
62 if platform == "bedrock":
63 if sync:
64 return AnthropicBedrock(
65 aws_region="us-east-1", api_key="fake-api-key", http_client=httpx2.Client(transport=transport)
66 )
67 return AsyncAnthropicBedrock(
68 aws_region="us-east-1", api_key="fake-api-key", http_client=httpx2.AsyncClient(transport=transport)
69 )
70
71 if sync:
72 return AnthropicVertex(
73 region="us-east5",
74 project_id="fake-project",
75 access_token="fake-access-token",
76 http_client=httpx2.Client(transport=transport),
77 )
78 return AsyncAnthropicVertex(
79 region="us-east5",
80 project_id="fake-project",
81 access_token="fake-access-token",
82 http_client=httpx2.AsyncClient(transport=transport),
83 )
84
85
86def public_members(value: object) -> set[str]:

Calls 4

AnthropicBedrockClass · 0.90
AnthropicVertexClass · 0.90

Tested by

no test coverage detected