X Tutup
Skip to content

Commit 50a48b0

Browse files
committed
Fixed bug in PDF download, where an authentication failure resulted in error message of 'Fault', rather than something more meaningful.
The root cause of this is that the auth-failure error response structure is different from other errors (e.g. JSON keys are all lower case) and an attempt to access response["Fault"] therefore failed, generating a key error exception rather than the auth failure exception.
1 parent b254493 commit 50a48b0

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

CHANGELOG.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
Changelog
22
========
33

4+
* 0.7.5 (May 11th, 2018)
5+
* Fixed bug with reporting authentication failure when attempting to download PDF (previously the error details were "lost")
6+
47
* 0.7.4 (March 26th, 2018)
58
* Fixed bug in SendMixin send method.
69
* Added support for send_to email to SendMixin.

quickbooks/client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,11 @@ def download_pdf(self, qbbo, item_id):
315315
response = self.process_request("GET", url, headers=headers)
316316

317317
if response.status_code != httplib.OK:
318+
319+
if response.status_code == httplib.UNAUTHORIZED:
320+
# Note that auth errors have different result structure which can't be parsed by handle_exceptions()
321+
raise AuthorizationException("Application authentication failed", detail=response.text)
322+
318323
try:
319324
result = response.json()
320325
except:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def read(*parts):
1010
return fp.read()
1111

1212

13-
VERSION = (0, 7, 4)
13+
VERSION = (0, 7, 5)
1414
version = '.'.join(map(str, VERSION))
1515

1616
setup(

0 commit comments

Comments
 (0)
X Tutup