Problem
tests/conftest.py wraps API.send_request to retry 502/503/504 because the prod edge "intermittently returns these under load — infra flakiness, not an SDK bug." That retry exists only in the test suite, so real consumers hit the same transient 5xx and get a ServerError on the first blip, with no handling.
Proposal
Move bounded retry-with-backoff into datamaxi/api.py::API.send_request (or _dispatch_request):
- Retry a small, configurable set of transient statuses (default
502, 503, 504) and connection/read timeouts.
- Linear or exponential backoff, capped attempts (e.g. 3).
- Opt-out / tunable via constructor kwargs (e.g.
max_retries=, retry_statuses=).
- Non-transient 4xx/5xx still raise immediately.
Notes
Problem
tests/conftest.pywrapsAPI.send_requestto retry502/503/504because the prod edge "intermittently returns these under load — infra flakiness, not an SDK bug." That retry exists only in the test suite, so real consumers hit the same transient 5xx and get aServerErroron the first blip, with no handling.Proposal
Move bounded retry-with-backoff into
datamaxi/api.py::API.send_request(or_dispatch_request):502, 503, 504) and connection/read timeouts.max_retries=,retry_statuses=).Notes
time.sleep) or considerurllib3.util.retry.Retryon the sharedSession(one Session now exists after refactor: share one Session across the client tree via composition (#2, #3) #137).