class ResilientSession(Session): (source)
This class is supposed to retry requests that do return temporary errors. :py:meth:`__recoverable` handles all retry-able errors.
Method | __init__ |
A Session subclass catered for the Jira API with exponential delaying retry. |
Method | request |
This is an intentional override of `Session.request()` to inject some error handling and retry logic. |
Instance Variable | headers |
Undocumented |
Instance Variable | max |
Undocumented |
Instance Variable | max |
Undocumented |
Instance Variable | timeout |
Undocumented |
Method | __handle |
Responses that report ok may also have errors. |
Method | __recoverable |
Return whether the request is recoverable and hence should be retried. |
Method | _jira |
Do any pre-processing of our own and return the updated kwargs. |
A Session subclass catered for the Jira API with exponential delaying retry. Args: timeout (Optional[Union[Union[float, int], Tuple[float, float]]]): Connection/read timeout delay. Defaults to None. max_retries (int): Max number of times to retry a request. Defaults to 3. max_retry_delay (int): Max delay allowed between retries. Defaults to 60.
str
, url: Union[ str, bytes]
, _prepare_retry_class: PrepareRequestForRetry
= PassthroughRetryPrepare(), **kwargs) -> Response
:
(source)
¶
This is an intentional override of `Session.request()` to inject some error handling and retry logic. Raises: Exception: Various exceptions as defined in py:method:`raise_on_error`. Returns: Response: The response.
Responses that report ok may also have errors. We can either log the error or raise the error as appropriate here. Args: response (Response): The response.
Optional[ Union[ ConnectionError, Response]]
, url: Union[ str, bytes]
, request_method: str
, counter: int
= 1):
(source)
¶
Return whether the request is recoverable and hence should be retried. Exponentially delays if recoverable. At this moment it supports: 429 Args: response (Optional[Union[ConnectionError, Response]]): The response or exception. Note: the response here is expected to be ``not response.ok``. url (Union[str, bytes]): The URL. request_method (str): The request method. counter (int, optional): The retry counter to use when calculating the exponential delay. Defaults to 1. Returns: bool: True if the request should be retried.