Skip to content

Commit a2082db

Browse files
Handle missing raw and retries on Response (#88)
1 parent 7fc823d commit a2082db

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scaleapi/api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ def _api_request(
144144
# Some endpoints only return 'OK' message without JSON
145145
return json
146146
elif res.status_code == 409 and "task" in endpoint and body.get("unique_id"):
147-
retry_history = None
148-
if "retries" in res.raw and "history" in res.raw.retries:
147+
try:
149148
retry_history = res.raw.retries.history
150-
149+
except AttributeError:
150+
retry_history = []
151151
# Example RequestHistory tuple
152152
# RequestHistory(method='POST',
153153
# url='/v1/task/imageannotation',

0 commit comments

Comments
 (0)