Skip to content

Exceptions

immichpy.client.generated.exceptions.ApiException

ApiException(status=None, reason=None, http_resp=None, *, body: Optional[str] = None, data: Optional[Any] = None)

Bases: OpenApiException

Source code in immichpy/client/generated/exceptions.py
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
def __init__(
    self,
    status=None,
    reason=None,
    http_resp=None,
    *,
    body: Optional[str] = None,
    data: Optional[Any] = None,
) -> None:
    self.status = status
    self.reason = reason
    self.body = body
    self.data = data
    self.headers = None

    if http_resp:
        if self.status is None:
            self.status = http_resp.status
        if self.reason is None:
            self.reason = http_resp.reason
        if self.body is None:
            try:
                self.body = http_resp.data.decode("utf-8")
            except Exception:
                pass
        self.headers = http_resp.headers

__str__

__str__()

Custom error messages for exception

Source code in immichpy/client/generated/exceptions.py
165
166
167
168
169
170
171
172
173
174
175
176
177
def __str__(self):
    """Custom error messages for exception"""
    error_message = "({0})\nReason: {1}\n".format(self.status, self.reason)
    if self.headers:
        error_message += "HTTP response headers: {0}\n".format(self.headers)

    if self.body:
        error_message += "HTTP response body: {0}\n".format(self.body)

    if self.data:
        error_message += "HTTP response data: {0}\n".format(self.data)

    return error_message

immichpy.client.generated.exceptions.BadRequestException

BadRequestException(status=None, reason=None, http_resp=None, *, body: Optional[str] = None, data: Optional[Any] = None)

Bases: ApiException

Source code in immichpy/client/generated/exceptions.py
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
def __init__(
    self,
    status=None,
    reason=None,
    http_resp=None,
    *,
    body: Optional[str] = None,
    data: Optional[Any] = None,
) -> None:
    self.status = status
    self.reason = reason
    self.body = body
    self.data = data
    self.headers = None

    if http_resp:
        if self.status is None:
            self.status = http_resp.status
        if self.reason is None:
            self.reason = http_resp.reason
        if self.body is None:
            try:
                self.body = http_resp.data.decode("utf-8")
            except Exception:
                pass
        self.headers = http_resp.headers

immichpy.client.generated.exceptions.NotFoundException

NotFoundException(status=None, reason=None, http_resp=None, *, body: Optional[str] = None, data: Optional[Any] = None)

Bases: ApiException

Source code in immichpy/client/generated/exceptions.py
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
def __init__(
    self,
    status=None,
    reason=None,
    http_resp=None,
    *,
    body: Optional[str] = None,
    data: Optional[Any] = None,
) -> None:
    self.status = status
    self.reason = reason
    self.body = body
    self.data = data
    self.headers = None

    if http_resp:
        if self.status is None:
            self.status = http_resp.status
        if self.reason is None:
            self.reason = http_resp.reason
        if self.body is None:
            try:
                self.body = http_resp.data.decode("utf-8")
            except Exception:
                pass
        self.headers = http_resp.headers

immichpy.client.generated.exceptions.UnauthorizedException

UnauthorizedException(status=None, reason=None, http_resp=None, *, body: Optional[str] = None, data: Optional[Any] = None)

Bases: ApiException

Source code in immichpy/client/generated/exceptions.py
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
def __init__(
    self,
    status=None,
    reason=None,
    http_resp=None,
    *,
    body: Optional[str] = None,
    data: Optional[Any] = None,
) -> None:
    self.status = status
    self.reason = reason
    self.body = body
    self.data = data
    self.headers = None

    if http_resp:
        if self.status is None:
            self.status = http_resp.status
        if self.reason is None:
            self.reason = http_resp.reason
        if self.body is None:
            try:
                self.body = http_resp.data.decode("utf-8")
            except Exception:
                pass
        self.headers = http_resp.headers

immichpy.client.generated.exceptions.ForbiddenException

ForbiddenException(status=None, reason=None, http_resp=None, *, body: Optional[str] = None, data: Optional[Any] = None)

Bases: ApiException

Source code in immichpy/client/generated/exceptions.py
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
def __init__(
    self,
    status=None,
    reason=None,
    http_resp=None,
    *,
    body: Optional[str] = None,
    data: Optional[Any] = None,
) -> None:
    self.status = status
    self.reason = reason
    self.body = body
    self.data = data
    self.headers = None

    if http_resp:
        if self.status is None:
            self.status = http_resp.status
        if self.reason is None:
            self.reason = http_resp.reason
        if self.body is None:
            try:
                self.body = http_resp.data.decode("utf-8")
            except Exception:
                pass
        self.headers = http_resp.headers

immichpy.client.generated.exceptions.ServiceException

ServiceException(status=None, reason=None, http_resp=None, *, body: Optional[str] = None, data: Optional[Any] = None)

Bases: ApiException

Source code in immichpy/client/generated/exceptions.py
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
def __init__(
    self,
    status=None,
    reason=None,
    http_resp=None,
    *,
    body: Optional[str] = None,
    data: Optional[Any] = None,
) -> None:
    self.status = status
    self.reason = reason
    self.body = body
    self.data = data
    self.headers = None

    if http_resp:
        if self.status is None:
            self.status = http_resp.status
        if self.reason is None:
            self.reason = http_resp.reason
        if self.body is None:
            try:
                self.body = http_resp.data.decode("utf-8")
            except Exception:
                pass
        self.headers = http_resp.headers

immichpy.client.generated.exceptions.ConflictException

ConflictException(status=None, reason=None, http_resp=None, *, body: Optional[str] = None, data: Optional[Any] = None)

Bases: ApiException

Exception for HTTP 409 Conflict.

Source code in immichpy/client/generated/exceptions.py
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
def __init__(
    self,
    status=None,
    reason=None,
    http_resp=None,
    *,
    body: Optional[str] = None,
    data: Optional[Any] = None,
) -> None:
    self.status = status
    self.reason = reason
    self.body = body
    self.data = data
    self.headers = None

    if http_resp:
        if self.status is None:
            self.status = http_resp.status
        if self.reason is None:
            self.reason = http_resp.reason
        if self.body is None:
            try:
                self.body = http_resp.data.decode("utf-8")
            except Exception:
                pass
        self.headers = http_resp.headers

immichpy.client.generated.exceptions.UnprocessableEntityException

UnprocessableEntityException(status=None, reason=None, http_resp=None, *, body: Optional[str] = None, data: Optional[Any] = None)

Bases: ApiException

Exception for HTTP 422 Unprocessable Entity.

Source code in immichpy/client/generated/exceptions.py
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
def __init__(
    self,
    status=None,
    reason=None,
    http_resp=None,
    *,
    body: Optional[str] = None,
    data: Optional[Any] = None,
) -> None:
    self.status = status
    self.reason = reason
    self.body = body
    self.data = data
    self.headers = None

    if http_resp:
        if self.status is None:
            self.status = http_resp.status
        if self.reason is None:
            self.reason = http_resp.reason
        if self.body is None:
            try:
                self.body = http_resp.data.decode("utf-8")
            except Exception:
                pass
        self.headers = http_resp.headers

immichpy.client.generated.exceptions.OpenApiException

Bases: Exception

The base exception class for all OpenAPIExceptions

immichpy.client.generated.exceptions.ApiTypeError

ApiTypeError(msg, path_to_item=None, valid_classes=None, key_type=None)

Bases: OpenApiException, TypeError

Raises an exception for TypeErrors

Args: msg (str): the exception message

Keyword Args: path_to_item (list): a list of keys an indices to get to the current_item None if unset valid_classes (tuple): the primitive classes that current item should be an instance of None if unset key_type (bool): False if our value is a value in a dict True if it is a key in a dict False if our item is an item in a list None if unset

Source code in immichpy/client/generated/exceptions.py
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
def __init__(
    self, msg, path_to_item=None, valid_classes=None, key_type=None
) -> None:
    """Raises an exception for TypeErrors

    Args:
        msg (str): the exception message

    Keyword Args:
        path_to_item (list): a list of keys an indices to get to the
                             current_item
                             None if unset
        valid_classes (tuple): the primitive classes that current item
                               should be an instance of
                               None if unset
        key_type (bool): False if our value is a value in a dict
                         True if it is a key in a dict
                         False if our item is an item in a list
                         None if unset
    """
    self.path_to_item = path_to_item
    self.valid_classes = valid_classes
    self.key_type = key_type
    full_msg = msg
    if path_to_item:
        full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
    super(ApiTypeError, self).__init__(full_msg)

immichpy.client.generated.exceptions.ApiValueError

ApiValueError(msg, path_to_item=None)

Bases: OpenApiException, ValueError

Args: msg (str): the exception message

Keyword Args: path_to_item (list) the path to the exception in the received_data dict. None if unset

Source code in immichpy/client/generated/exceptions.py
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
def __init__(self, msg, path_to_item=None) -> None:
    """
    Args:
        msg (str): the exception message

    Keyword Args:
        path_to_item (list) the path to the exception in the
            received_data dict. None if unset
    """

    self.path_to_item = path_to_item
    full_msg = msg
    if path_to_item:
        full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
    super(ApiValueError, self).__init__(full_msg)

immichpy.client.generated.exceptions.ApiAttributeError

ApiAttributeError(msg, path_to_item=None)

Bases: OpenApiException, AttributeError

Raised when an attribute reference or assignment fails.

Args: msg (str): the exception message

Keyword Args: path_to_item (None/list) the path to the exception in the received_data dict

Source code in immichpy/client/generated/exceptions.py
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
def __init__(self, msg, path_to_item=None) -> None:
    """
    Raised when an attribute reference or assignment fails.

    Args:
        msg (str): the exception message

    Keyword Args:
        path_to_item (None/list) the path to the exception in the
            received_data dict
    """
    self.path_to_item = path_to_item
    full_msg = msg
    if path_to_item:
        full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
    super(ApiAttributeError, self).__init__(full_msg)

immichpy.client.generated.exceptions.ApiKeyError

ApiKeyError(msg, path_to_item=None)

Bases: OpenApiException, KeyError

Args: msg (str): the exception message

Keyword Args: path_to_item (None/list) the path to the exception in the received_data dict

Source code in immichpy/client/generated/exceptions.py
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
def __init__(self, msg, path_to_item=None) -> None:
    """
    Args:
        msg (str): the exception message

    Keyword Args:
        path_to_item (None/list) the path to the exception in the
            received_data dict
    """
    self.path_to_item = path_to_item
    full_msg = msg
    if path_to_item:
        full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
    super(ApiKeyError, self).__init__(full_msg)