From 6fecaf3d8eca06433dddbc38bf1d7db7b49c77ee Mon Sep 17 00:00:00 2001 From: Hrishabh Tiwari <74908943+Hrishabh17@users.noreply.github.com> Date: Tue, 13 Feb 2024 18:07:34 +0530 Subject: [PATCH] Modified the retry logic for handling Internal Server Errors (#84) --- fyle/platform/internals/api_base.py | 2 +- fyle/platform/internals/decorators.py | 3 +++ setup.py | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fyle/platform/internals/api_base.py b/fyle/platform/internals/api_base.py index ffc61c4..819935a 100644 --- a/fyle/platform/internals/api_base.py +++ b/fyle/platform/internals/api_base.py @@ -26,7 +26,7 @@ def _format_api_url(self, endpoint): endpoint=endpoint ) - @retry(n=3, backoff=5, exceptions=exceptions.InvalidTokenError) + @retry(n=3, backoff=5, exceptions=(exceptions.InvalidTokenError, exceptions.InternalServerError)) def make_get_request(self, api_url, query_params=None): """Create a HTTP GET request. Parameters: diff --git a/fyle/platform/internals/decorators.py b/fyle/platform/internals/decorators.py index 04bf67c..063caa9 100644 --- a/fyle/platform/internals/decorators.py +++ b/fyle/platform/internals/decorators.py @@ -4,6 +4,8 @@ import time +from functools import wraps + from .auth import Auth from .. import exceptions as exc @@ -19,6 +21,7 @@ def retry(n, backoff, exceptions): """ def decorator(func): + @wraps(func) def new_fn(*args, **kwargs): attempt = 0 while attempt < n: diff --git a/setup.py b/setup.py index e35a222..3ebb8e7 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name='fyle', - version='v0.36.0', + version='v0.36.1', author='Siva Narayanan', author_email='siva@fyle.in', description='Python SDK for accessing Fyle Platform APIs',