I am looking for a python library that allows me to slow down my rate of requests to a remote API when the execution time becomes slow.
For example, in Java, we have resilience4j with circuit breaker, which allows us to configure both the failure rate threshold (percentage of calls that failed) and the slow call threshold (percentage of calls that run longer than a certain amount of milliseconds). If any of these threshold occurs, the circuit breaker will switch to OPEN state and make us wait for a configurable amount of time before allowing the requests to go through again.
I have looked at two different libs for python for circuit breaker: circuit-breaker and pybreaker but both of them only allow me to configure the failure threshold, but not the slow call threshold.
I would appreciate if someone can suggest a library that allows one to slow down the rate of requests when calls to a remote API becomes slow.