How to use the splitwise.exception.SplitwiseException function in splitwise

To help you get started, we’ve selected a few splitwise examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github namaggarwal / splitwise / splitwise / exception.py View on Github external
def __init__(
        self,
        message,
        response=None
    ):
        """ Exception based on requests library Response.

        Args:
            message(str): Exception message
            response(:obj:`requests.Response`, optional): response object from requests library
        """
        super(SplitwiseException, self).__init__(
            message=message
        )

        if response is not None:
            self.http_body = response.content,
            self.http_status = response.status_code,
            self.http_headers = response.headers
github namaggarwal / splitwise / splitwise / exception.py View on Github external
Args:
            message(str): Exception message
            response(:obj:`requests.Response`, optional): response object from requests library
        """
        super(SplitwiseException, self).__init__(
            message=message
        )

        if response is not None:
            self.http_body = response.content,
            self.http_status = response.status_code,
            self.http_headers = response.headers


class SplitwiseUnauthorizedException(SplitwiseException):
    """ Exception when request to splitwise is unauthorized

        Inherits: :class:`splitwise.exception.SplitwiseException`
    """
    pass


class SplitwiseBadRequestException(SplitwiseException):
    """ Exception when request returns bad request

        Inherits: :class:`splitwise.exception.SplitwiseException`
    """
    pass


class SplitwiseNotAllowedException(SplitwiseException):
github namaggarwal / splitwise / splitwise / __init__.py View on Github external
return response.content.decode("utf-8")
            return response.content

        if response.status_code == 401:
            raise SplitwiseUnauthorizedException("Please check your token or consumer id and secret", response=response)

        if response.status_code == 403:
            raise SplitwiseNotAllowedException("You are not allowed to perform this operation", response=response)

        if response.status_code == 400:
            raise SplitwiseBadRequestException("Please check your request", response=response)

        if response.status_code == 404:
            raise SplitwiseNotFoundException("Required resource is not found", response)

        raise SplitwiseException("Unknown error happened", response)
github namaggarwal / splitwise / splitwise / exception.py View on Github external
if response is not None:
            self.http_body = response.content,
            self.http_status = response.status_code,
            self.http_headers = response.headers


class SplitwiseUnauthorizedException(SplitwiseException):
    """ Exception when request to splitwise is unauthorized

        Inherits: :class:`splitwise.exception.SplitwiseException`
    """
    pass


class SplitwiseBadRequestException(SplitwiseException):
    """ Exception when request returns bad request

        Inherits: :class:`splitwise.exception.SplitwiseException`
    """
    pass


class SplitwiseNotAllowedException(SplitwiseException):
    """ Exception when request to splitwise is not allowed

        Inherits: :class:`splitwise.exception.SplitwiseException`
    """
    pass


class SplitwiseNotFoundException(SplitwiseException):
github namaggarwal / splitwise / splitwise / exception.py View on Github external
""" Exception when request to splitwise is unauthorized

        Inherits: :class:`splitwise.exception.SplitwiseException`
    """
    pass


class SplitwiseBadRequestException(SplitwiseException):
    """ Exception when request returns bad request

        Inherits: :class:`splitwise.exception.SplitwiseException`
    """
    pass


class SplitwiseNotAllowedException(SplitwiseException):
    """ Exception when request to splitwise is not allowed

        Inherits: :class:`splitwise.exception.SplitwiseException`
    """
    pass


class SplitwiseNotFoundException(SplitwiseException):
    """ Exception when request to splitwise returns not found

        Inherits: :class:`splitwise.exception.SplitwiseBaseException`
    """
    pass
github namaggarwal / splitwise / splitwise / exception.py View on Github external
""" Exception when request returns bad request

        Inherits: :class:`splitwise.exception.SplitwiseException`
    """
    pass


class SplitwiseNotAllowedException(SplitwiseException):
    """ Exception when request to splitwise is not allowed

        Inherits: :class:`splitwise.exception.SplitwiseException`
    """
    pass


class SplitwiseNotFoundException(SplitwiseException):
    """ Exception when request to splitwise returns not found

        Inherits: :class:`splitwise.exception.SplitwiseBaseException`
    """
    pass