How to use the splitwise.exception.SplitwiseBaseException 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 __repr__(self):
        return "%s(message=%r, http_status=%r)" % (
            self.__class__.__name__,
            self._message,
            self.http_status
        )

    def setMessage(self, message):
        """ Sets the exception message
          Args:
                message(str): Exception message
        """
        self._message = message


class SplitwiseException(SplitwiseBaseException):
    """ Exception based on requests library Response.

        Inherits: :class:`splitwise.exception.SplitwiseBaseException`
    """
    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__(
github namaggarwal / splitwise / splitwise / exception.py View on Github external
def __init__(
        self,
        message=None,
        http_body=None,
        http_status=None,
        http_headers=None
    ):
        """
          Args:
                message(str, optional): Exception message
                http_body(str, optional): HTTP body
                http_status(int, optional): HTTP status code
                http_headers(:obj:`dict`, optional): Dict containing header key and value
        """
        super(SplitwiseBaseException, self).__init__(message)

        if http_body and hasattr(http_body, "decode"):
            try:
                http_body = http_body.decode("utf-8")
            except BaseException:
                http_body = (
                    ""
                )

        self._message = message
        self.http_body = http_body
        self.http_status = http_status
        self.http_headers = http_headers or {}
        self.errors = {}
        if self.http_body:
            try: