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

Method retry_handler

tests/test_client.py:3211–3218  ·  view source on GitHub ↗
(_request: httpx2.Request)

Source from the content-addressed store, hash-verified

3209 nb_retries = 0
3210
3211 def retry_handler(_request: httpx2.Request) -> httpx2.Response:
3212 nonlocal nb_retries
3213 if nb_retries < failures_before_success:
3214 nb_retries += 1
3215 if failure_mode == "exception":
3216 raise RuntimeError("oops")
3217 return httpx2.Response(500)
3218 return httpx2.Response(200)
3219
3220 respx_mock.post("/v1/messages").mock(side_effect=retry_handler)
3221

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected