From 45b587166d3a65fdf9fa706883ce37dc2b2992a8 Mon Sep 17 00:00:00 2001 From: Hrishabh Tiwari <74908943+Hrishabh17@users.noreply.github.com> Date: Wed, 6 Mar 2024 17:05:39 +0530 Subject: [PATCH] Modify get generator for yielding 1000 records (#26) * Added generator for the get calls * fixed the loop terminate * Added method for fetching inactive records * Modified the last_updated_at arg to optional * Modified loop terminate condition to avoid KeyError * Modified generator to yield 1000 records at a time --- qbosdk/apis/api_base.py | 3 +-- setup.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/qbosdk/apis/api_base.py b/qbosdk/apis/api_base.py index dbd105f..f843603 100644 --- a/qbosdk/apis/api_base.py +++ b/qbosdk/apis/api_base.py @@ -113,8 +113,7 @@ def _query_get_all_generator(self, object_type: str, url: str) -> Generator[Dict if not query_response or object_type not in query_response: break - for obj in query_response[object_type]: - yield obj + yield query_response[object_type] start_position += 1000 diff --git a/setup.py b/setup.py index ef4cdec..442ccfc 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setuptools.setup( name='qbosdk', - version='0.17.1', + version='0.17.2', author='Shwetabh Kumar', author_email='shwetabh.kumar@fyle.in', description='Python SDK for accessing Quickbooks Online APIs',