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

Method retry_handler

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

Source from the content-addressed store, hash-verified

2846 nb_retries = 0
2847
2848 def retry_handler(_request: httpx2.Request) -> httpx2.Response:
2849 nonlocal nb_retries
2850 if nb_retries < failures_before_success:
2851 nb_retries += 1
2852 if failure_mode == "exception":
2853 raise RuntimeError("oops")
2854 return httpx2.Response(500)
2855 return httpx2.Response(200)
2856
2857 respx_mock.post("/v1/messages").mock(side_effect=retry_handler)
2858

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected