From 98f96840bfe5e76e9b6f4801fb1021f79906c853 Mon Sep 17 00:00:00 2001 From: ashwin1111 Date: Fri, 1 Sep 2023 18:53:56 +0530 Subject: [PATCH 1/2] Support Accounting Export Summary Bulk POST --- fyle/platform/apis/v1beta/admin/expenses.py | 8 ++++++++ setup.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/fyle/platform/apis/v1beta/admin/expenses.py b/fyle/platform/apis/v1beta/admin/expenses.py index 929b996..79c9877 100644 --- a/fyle/platform/apis/v1beta/admin/expenses.py +++ b/fyle/platform/apis/v1beta/admin/expenses.py @@ -1,6 +1,7 @@ """ V1 Beta Admin Expenses """ +from typing import Dict from ....internals.get_resources import GetResources from ....internals.list_all_resources import ListAllResources @@ -12,6 +13,13 @@ class Expenses(ListResources, ListAllResources, PostResources, GetResources): """Class for Expenses APIs.""" EXPENSES = '/expenses' + ACCOUNTING_EXPORT_SUMMARY_BULK = '/expenses/accounting_export_summary/bulk' def __init__(self, version, role): super().__init__(version, role, Expenses.EXPENSES) + + def post_bulk_accounting_export_summary(self, payload: dict) -> Dict: + return self.api.make_post_request( + api_url=self.ACCOUNTING_EXPORT_SUMMARY_BULK, + payload=payload + ) diff --git a/setup.py b/setup.py index 1677a3f..d202154 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name='fyle', - version='v0.32.0', + version='v0.33.0', author='Siva Narayanan', author_email='siva@fyle.in', description='Python SDK for accessing Fyle Platform APIs', From b1c8afa99c0cd50c2655f7617bcdc73589098574 Mon Sep 17 00:00:00 2001 From: ashwin1111 Date: Fri, 6 Oct 2023 10:55:44 +0530 Subject: [PATCH 2/2] Fix retry decorator --- fyle/platform/internals/decorators.py | 6 +++--- setup.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fyle/platform/internals/decorators.py b/fyle/platform/internals/decorators.py index 396a179..04bf67c 100644 --- a/fyle/platform/internals/decorators.py +++ b/fyle/platform/internals/decorators.py @@ -24,12 +24,12 @@ def new_fn(*args, **kwargs): while attempt < n: try: return func(*args, **kwargs) - except exceptions: - if exc.InvalidTokenError in exceptions: + except exceptions as e: + if isinstance(e, exc.InvalidTokenError): Auth().update_access_token() time.sleep(backoff) attempt += 1 - raise exc.RetryException('failed to execute %s despite retrying' % func) + raise exc.RetryException('failed to execute %s despite retrying' % func.__name__) return new_fn diff --git a/setup.py b/setup.py index d202154..858b91e 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name='fyle', - version='v0.33.0', + version='v0.33.1', author='Siva Narayanan', author_email='siva@fyle.in', description='Python SDK for accessing Fyle Platform APIs',