MCPcopy Create free account
hub / github.com/DeepL/deepl-python / _should_retry

Method _should_retry

deepl/http_client.py:199–210  ·  view source on GitHub ↗
(self, response, exception, num_retries)

Source from the content-addressed store, hash-verified

197 raise ConnectionException(message, should_retry=False) from e
198
199 def _should_retry(self, response, exception, num_retries):
200 if num_retries >= max_network_retries:
201 return False
202
203 if response is None:
204 return exception.should_retry
205
206 status_code, _ = response
207 # Retry on Too-Many-Requests error and internal errors
208 return status_code == http.HTTPStatus.TOO_MANY_REQUESTS or (
209 status_code >= http.HTTPStatus.INTERNAL_SERVER_ERROR
210 )
211
212 def _prepare_request(
213 self,

Callers 1

request_with_backoffMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected