pydiagral 1.0.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
pydiagral/constants.py ADDED
@@ -0,0 +1,4 @@
1
+ """Constants for the Diagral API integration."""
2
+
3
+ BASE_URL = "https://appv3.tt-monitor.com/emerald"
4
+ API_VERSION = "v1"
@@ -0,0 +1,39 @@
1
+ """Module defining custom exceptions for the Diagral API."""
2
+
3
+
4
+ class DiagralAPIError(Exception):
5
+ """Base exception for Diagral API errors."""
6
+
7
+ def __init__(self, message: str, status_code: int | None = None) -> None:
8
+ """Initialize the DiagralAPIError.
9
+
10
+ :param message: The error message.
11
+ :param status_code: The status code of the error, if any.
12
+ """
13
+ self.message = message
14
+ self.status_code = status_code
15
+ super().__init__(self.message)
16
+
17
+
18
+ class ConfigurationError(DiagralAPIError):
19
+ """Raised when configuration is invalid."""
20
+
21
+
22
+ class SessionError(DiagralAPIError):
23
+ """Raised when session is invalid."""
24
+
25
+
26
+ class AuthenticationError(DiagralAPIError):
27
+ """Raised when authentication fails."""
28
+
29
+
30
+ class ValidationError(DiagralAPIError):
31
+ """Raised when validation fails."""
32
+
33
+
34
+ class ServerError(DiagralAPIError):
35
+ """Raised when server returns 5xx error."""
36
+
37
+
38
+ class ClientError(DiagralAPIError):
39
+ """Raised when client returns error."""