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

Function new

tests/test_tracing.py:129–144  ·  view source on GitHub ↗
(server: Server | None = None, open_telemetry: OpenTelemetryClientOption = None)

Source from the content-addressed store, hash-verified

127 """Constructs a client, which reads the environment. One that is given a `server` sends its requests there."""
128
129 def new(server: Server | None = None, open_telemetry: OpenTelemetryClientOption = None) -> Client:
130 http_client: Any = None
131 if server is not None:
132 http_client_class = httpx2.Client if request.param is Anthropic else httpx2.AsyncClient
133 http_client = http_client_class(transport=httpx2.MockTransport(server))
134 return cast(
135 Client,
136 request.param(
137 base_url=base_url,
138 api_key=api_key,
139 _strict_response_validation=True,
140 http_client=http_client,
141 open_telemetry=open_telemetry,
142 max_retries=1,
143 ),
144 )
145
146 return new
147

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected