reg: Django custom middleware

2024-01-24 Thread 'Amitesh Sahay' via Django users
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

Re: reg: Django custom middleware

2024-01-24 Thread ASAMOAH EMMANUEL
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