Skip to content

Commit 645b158

Browse files
authored
fix: attachment post response (#50)
1 parent c697037 commit 645b158

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

qbosdk/apis/api_base.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,12 @@ def _post_file(self, data, api_url):
351351
if response.status_code == 200:
352352
logger.debug('Response for post request: %s', response.text)
353353
result = json.loads(response.text)
354-
return result['AttachableResponse'][0]['Attachable']
355354

355+
if 'AttachableResponse' in result and result['AttachableResponse'] and len(result['AttachableResponse']) > 0 and 'Attachable' in result['AttachableResponse'][0]:
356+
return result['AttachableResponse'][0]['Attachable']
357+
else:
358+
logger.info('Received unexpected attachment post response: %s', response.text)
359+
raise WrongParamsError('Received unexpected attachment post response', response.text)
356360

357361
logger.debug('Payload for post request: %s', data)
358362
logger.info('Response for post request: %s', response.text)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setuptools.setup(
1010
name='qbosdk',
11-
version='1.4.1',
11+
version='1.4.2',
1212
author='Shwetabh Kumar',
1313
author_email='shwetabh.kumar@fyle.in',
1414
description='Python SDK for accessing Quickbooks Online APIs',

0 commit comments

Comments
 (0)