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

Function queue_responses

tests/lib/threads/helpers.py:287–290  ·  view source on GitHub ↗

Answer the next `len(responses)` Messages API requests with `responses`, in order. An exception is raised in place of a response.

(respx_mock: MockRouter, *responses: httpx2.Response | Exception)

Source from the content-addressed store, hash-verified

285
286
287def queue_responses(respx_mock: MockRouter, *responses: httpx2.Response | Exception) -> Route:
288 """Answer the next `len(responses)` Messages API requests with `responses`, in order. An exception is raised in
289 place of a response."""
290 return respx_mock.post("/v1/messages").mock(side_effect=list(responses))
291
292
293def message_response(

Calls 1

postMethod · 0.45