From 2545106e3713a8e75080d24ec133ed06a59bbf66 Mon Sep 17 00:00:00 2001 From: ruuushhh <66899387+ruuushhh@users.noreply.github.com> Date: Thu, 25 Jan 2024 11:41:13 +0530 Subject: [PATCH] Fix error logic (#17) * Fixing Company ID allocation for Batch URLs * Fix Batch upload error logic --------- Co-authored-by: Shwetabh Kumar --- .gitignore | 1 + dynamics/apis/api_base.py | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index bccc793..8470d15 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ __pycache__/ # Mock Files dry_run.py +test.py # Distribution / packaging .Python diff --git a/dynamics/apis/api_base.py b/dynamics/apis/api_base.py index b05e37c..b1b7b77 100644 --- a/dynamics/apis/api_base.py +++ b/dynamics/apis/api_base.py @@ -271,7 +271,7 @@ def _bulk_post_request(self, data, isolation: str, company_id: str = None, purch if response.status_code == 200 or response.status_code == 201: result = json.loads(response.text) - error_messages = [resp.get("body", {}).get("error", {}).get("message", None) for resp in result.get("responses", []) if resp.get("status", None) == 400] + error_messages = [resp.get('body', {}).get('error', {}).get('message', None) for resp in result.get('responses', []) if 400 <= resp.get('status', 0) < 500] error_messages = [message for message in error_messages if message is not None] if error_messages: diff --git a/setup.py b/setup.py index 96a99da..388289b 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name='ms-dynamics-business-central-sdk', - version='1.4.0', + version='1.4.1', author='Shwetabh Kumar', author_email='shwetabh.kumar@fyle.in', description='Python SDK for accessing Dynamics APIs',