Skip to content

Commit

Permalink
Modified the retry logic for handling Internal Server Errors (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hrishabh17 authored Feb 13, 2024
1 parent 2fbe099 commit 6fecaf3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fyle/platform/internals/api_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions fyle/platform/internals/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import time

from functools import wraps

from .auth import Auth
from .. import exceptions as exc

Expand All @@ -19,6 +21,7 @@ def retry(n, backoff, exceptions):
"""

def decorator(func):
@wraps(func)
def new_fn(*args, **kwargs):
attempt = 0
while attempt < n:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name='fyle',
version='v0.36.0',
version='v0.36.1',
author='Siva Narayanan',
author_email='[email protected]',
description='Python SDK for accessing Fyle Platform APIs',
Expand Down

0 comments on commit 6fecaf3

Please sign in to comment.