Skip to content

Commit

Permalink
added check for empty list and return status code
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan-Prescott committed Sep 17, 2024
1 parent c4d821b commit dbd9d6c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions odins_spear/requester.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ def _request(self, method, endpoint, data=None, params=None):
)
self.logger._log_request(endpoint=endpoint, response_code=response.status_code)
response.raise_for_status()
if isinstance(response.json(), list):
return response.request.body

if response.text == '[]':
return response.status_code
return response.json()


Expand All @@ -60,7 +61,8 @@ def _rate_limited_request(self, method, endpoint, data=None, params=None):
)
self.logger._log_request(endpoint=endpoint, response_code=response.status_code)
response.raise_for_status()
if isinstance(response.json(), list):
return response.request.body

if response.text == '[]':
return response.status_code
return response.json()

0 comments on commit dbd9d6c

Please sign in to comment.