Skip to content

Commit cca9e6a

Browse files
fix: handle gracefully JSON decoding exception
1 parent f028d55 commit cca9e6a

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ Installation
1515
The package's installation is done using pypi:
1616

1717
``` sh
18-
pip install processOut
18+
pip install processout
1919
```
2020

2121
If you don't want to use pip to install this package, you may simply do a git clone
22-
of this repository.
22+
of this repository.

processout/networking/response.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ def __init__(self, resp):
1616
self._headers = resp.headers
1717
self._raw_body = resp.text
1818

19-
self._body = resp.json()
19+
try:
20+
self._body = resp.json()
21+
except BaseException:
22+
self._body = {}
2023

2124
self._check()
2225

@@ -48,7 +51,7 @@ def raw_body(self):
4851
@property
4952
def success(self):
5053
"""Get the response status"""
51-
if self.body["success"] is None or not self.body["success"]:
54+
if self.body.get("success") is None or not self.body["success"]:
5255
return False
5356

5457
return True

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
setup(
44
name = 'processout',
55
packages = ['processout', 'processout.errors', 'processout.networking'],
6-
version = '6.29.0',
6+
version = '6.29.1',
77
description = 'ProcessOut API bindings.',
88
author = 'ProcessOut',
99
author_email = '[email protected]',
1010
url = 'https://github.com/processout/processout-python',
11-
download_url = 'https://github.com/processout/processout-python/tarball/6.29.0',
11+
download_url = 'https://github.com/processout/processout-python/tarball/6.29.1',
1212
keywords = ['ProcessOut', 'api', 'bindings'],
1313
classifiers = [],
1414
)

0 commit comments

Comments
 (0)