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

Method retry_handler

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

Source from the content-addressed store, hash-verified

2883 nb_retries = 0
2884
2885 def retry_handler(_request: httpx2.Request) -> httpx2.Response:
2886 nonlocal nb_retries
2887 if nb_retries < failures_before_success:
2888 nb_retries += 1
2889 if failure_mode == "exception":
2890 raise RuntimeError("oops")
2891 return httpx2.Response(500)
2892 return httpx2.Response(200)
2893
2894 respx_mock.post("/v1/messages").mock(side_effect=retry_handler)
2895

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected