Skip to content

Commit

Permalink
Merge pull request #12 from uKaigo/fix-exceptions
Browse files Browse the repository at this point in the history
Treat 404 errors as a valid response.
  • Loading branch information
AndyTempel authored Dec 11, 2020
2 parents b9822e2 + bc30dad commit 2c27a2f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ksoftapi/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ async def _validate_response(self, response: aiohttp.ClientResponse):

if json.get('error', False):
code = json.get('code', response.status)
message = json.get('message', '<No message>')
raise APIError(code, message)
if code != 404:
message = json.get('message', '<No message>')
raise APIError(code, message)

async def get(self, path: str, params=None, headers=None, to_json=True):
merged_headers = {**headers, **self._default_headers} if headers else self._default_headers
Expand Down

0 comments on commit 2c27a2f

Please sign in to comment.