Skip to content

Commit 031831e

Browse files
committed
Created use_decimal flag on client creation
ej2#358 (comment)
1 parent 4158e8b commit 031831e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

quickbooks/client.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class QuickBooks(object):
2626
minorversion = None
2727
verifier_token = None
2828
invoice_link = False
29+
use_decimal = False
2930

3031
sandbox_api_url_v3 = "https://sandbox-quickbooks.api.intuit.com/v3"
3132
api_url_v3 = "https://quickbooks.api.intuit.com/v3"
@@ -81,6 +82,9 @@ def __new__(cls, **kwargs):
8182
if 'verifier_token' in kwargs:
8283
instance.verifier_token = kwargs.get('verifier_token')
8384

85+
if 'use_decimal' in kwargs:
86+
instance.use_decimal = kwargs.get('use_decimal')
87+
8488
return instance
8589

8690
def _start_session(self):
@@ -208,7 +212,10 @@ def make_request(self, request_type, url, request_body=None, content_type='appli
208212
"Application authentication failed", error_code=req.status_code, detail=req.text)
209213

210214
try:
211-
result = json.loads(req.text, parse_float=decimal.Decimal)
215+
if (self.use_decimal):
216+
result = json.loads(req.text, parse_float=decimal.Decimal)
217+
else:
218+
result = json.loads(req.text)
212219
except:
213220
raise exceptions.QuickbooksException("Error reading json response: {0}".format(req.text), 10000)
214221

0 commit comments

Comments
 (0)