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

Method replay

tests/test_open_telemetry.py:1422–1434  ·  view source on GitHub ↗
(request: Any, call_next: Callable[[Any], Any])

Source from the content-addressed store, hash-verified

1420
1421 def test_stream_over_a_response_that_a_middleware_made_from_bytes(self, spans: Spans) -> None:
1422 def replay(request: Any, call_next: Callable[[Any], Any]) -> Any:
1423 sent = call_next(request)
1424 sent.close()
1425 # The body of a response that is made from bytes is a sync and an async one at once.
1426 raw = stream_response()
1427 return APIResponse(
1428 raw=raw,
1429 cast_to=request.cast_to,
1430 client=client,
1431 stream=True,
1432 stream_cls=request.stream_cls,
1433 options=request.options,
1434 )
1435
1436 transport = httpx2.MockTransport(lambda _: stream_response())
1437 client = make_client(spans, http_client=httpx2.Client(transport=transport), middleware=[replay])

Callers

nothing calls this directly

Calls 4

APIResponseClass · 0.90
AsyncAPIResponseClass · 0.90
stream_responseFunction · 0.70
closeMethod · 0.45

Tested by

no test coverage detected