Skip to content

ThreatMatrixClientException

ThreatMatrixClientException Class

Bases: RequestException

Source code in docs/Submodules/pythreatmatrix/pythreatmatrix/exceptions.py
class ThreatMatrixClientException(RequestException):
    @property
    def error_detail(self) -> typing.Union[typing.Dict, typing.AnyStr]:
        content = None
        try:
            content = self.response.json()
            detail = content.get("detail", None)
            if detail:
                content = detail
        except json.JSONDecodeError:
            content = self.response.content
        except Exception:
            pass

        return content

    def __str__(self):
        err_msg = super().__str__()
        detail = self.error_detail
        return err_msg + f". Details: {detail}"