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

Method retry_handler

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

Source from the content-addressed store, hash-verified

1378 nb_retries = 0
1379
1380 def retry_handler(_request: httpx2.Request) -> httpx2.Response:
1381 nonlocal nb_retries
1382 if nb_retries < failures_before_success:
1383 nb_retries += 1
1384 if failure_mode == "exception":
1385 raise RuntimeError("oops")
1386 return httpx2.Response(500)
1387 return httpx2.Response(200)
1388
1389 respx_mock.post("/v1/messages").mock(side_effect=retry_handler)
1390

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected