Skip to content

Commit

Permalink
Fix error logic (#17)
Browse files Browse the repository at this point in the history
* Fixing Company ID allocation for Batch URLs

* Fix Batch upload error logic

---------

Co-authored-by: Shwetabh Kumar <[email protected]>
  • Loading branch information
ruuushhh and Shwetabhk authored Jan 25, 2024
1 parent d8404f3 commit 2545106
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ __pycache__/

# Mock Files
dry_run.py
test.py

# Distribution / packaging
.Python
Expand Down
2 changes: 1 addition & 1 deletion dynamics/apis/api_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
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='ms-dynamics-business-central-sdk',
version='1.4.0',
version='1.4.1',
author='Shwetabh Kumar',
author_email='[email protected]',
description='Python SDK for accessing Dynamics APIs',
Expand Down

0 comments on commit 2545106

Please sign in to comment.