Hi All,
I have written a custom Django middleware to do retries and catch exception if
there is any connection related issues between two servers. Below is the code
snippet.
from requests.adapters import Retry, RetryError, HTTPAdapter, MaxRetryError,
ConnectTimeoutError, ProtocolError, ResponseE
class RetryCal:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
try:
session = Session()
retries = Retry(total=5, backoff_factor=2,
status_forcelist=[500, 502, 503, 504])
session.mount('http
2 matches
Mail list logo