Skip to content

Commit

Permalink
Add forbidden exception
Browse files Browse the repository at this point in the history
  • Loading branch information
frwickst committed Dec 27, 2023
1 parent cd70178 commit 633e2c5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions huum/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@ class NotAuthenticated(HuumError):
pass


class Forbidden(HuumError):
pass


class RequestError(HuumError):
pass
10 changes: 9 additions & 1 deletion huum/huum.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
from aiohttp import ClientResponse

from huum.const import SaunaStatus
from huum.exceptions import BadRequest, NotAuthenticated, RequestError, SafetyException
from huum.exceptions import (
BadRequest,
Forbidden,
NotAuthenticated,
RequestError,
SafetyException,
)
from huum.schemas import HuumStatusResponse

API_BASE = "https://api.huum.eu/action/"
Expand Down Expand Up @@ -75,6 +81,8 @@ async def _make_call(
raise BadRequest("Bad request") from err
case 401:
raise NotAuthenticated("Not authenticated") from err
case 403:
raise Forbidden("Forbidden") from err
raise RequestError() from err

return response
Expand Down

0 comments on commit 633e2c5

Please sign in to comment.