Skip to content

Commit 809b012

Browse files
committed
added missing error handling
1 parent 2dfb5b1 commit 809b012

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ThreadFixProApi/API.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
__status__ = "Production"
88
__license__ = "MIT"
99

10+
import json
1011
import requests
1112
import urllib3
1213

@@ -92,7 +93,10 @@ def request(self, method, url, params=None, files=None):
9293
response_code = json_response['responseCode']
9394
except KeyError:
9495
response_code = response.status_code
95-
success = True if response_code >= 200 and response_code < 210 else False
96+
try:
97+
success = json_response['success']
98+
except KeyError:
99+
success = True if response_code >= 200 and response_code < 210 else False
96100
try:
97101
data = json_response['object']
98102
except KeyError:

0 commit comments

Comments
 (0)