Skip to content

Commit 4e0ed91

Browse files
committed
v0.2.3: small bug fix to make 'nojson' mode work correctly
1 parent b5d7681 commit 4e0ed91

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

marketorestpython/helper/http_lib.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ def get(self, endpoint, args=None, mode=None):
3030
return None
3131
try:
3232
r = requests.get(endpoint, params=args)
33-
r_json = r.json()
34-
# if we still hit the rate limiter, raise an error so the call will be retried
35-
if 'success' in r_json:
36-
if r_json['success'] == False:
37-
print(r_json['errors'][0])
38-
if r_json['errors'][0]['code'] == 606:
39-
print('error 606, rate limiter')
40-
raise
4133
if mode is 'nojson':
4234
return r
4335
else:
36+
r_json = r.json()
37+
# if we still hit the rate limiter, raise an error so the call will be retried
38+
if 'success' in r_json:
39+
if r_json['success'] == False:
40+
print(r_json['errors'][0])
41+
if r_json['errors'][0]['code'] == 606:
42+
print('error 606, rate limiter')
43+
raise
4444
return r_json
4545
except Exception as e:
4646
print("HTTP Get Exception! Retrying.....")

0 commit comments

Comments
 (0)