MCPcopy
hub / github.com/anthropics/anthropic-sdk-python / async_client

Function async_client

tests/conftest.py:112–134  ·  view source on GitHub ↗
(request: FixtureRequest)

Source from the content-addressed store, hash-verified

110
111@pytest.fixture(scope="session")
112async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncAnthropic]:
113 param = getattr(request, "param", True)
114
115 # defaults
116 strict = True
117 http_client: None | httpx.AsyncClient = None
118
119 if isinstance(param, bool):
120 strict = param
121 elif is_dict(param):
122 strict = param.get("strict", True)
123 assert isinstance(strict, bool)
124
125 http_client_type = param.get("http_client", "httpx")
126 if http_client_type == "aiohttp":
127 http_client = DefaultAioHttpClient()
128 else:
129 raise TypeError(f"Unexpected fixture parameter type {type(param)}, expected bool or dict")
130
131 async with AsyncAnthropic(
132 base_url=base_url, api_key=api_key, _strict_response_validation=strict, http_client=http_client
133 ) as client:
134 yield client

Callers

nothing calls this directly

Calls 3

is_dictFunction · 0.90
AsyncAnthropicClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected