pythonkuma 0.0.0rc1__tar.gz → 0.0.0rc2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pythonkuma-0.0.0rc1 → pythonkuma-0.0.0rc2}/PKG-INFO +1 -1
- {pythonkuma-0.0.0rc1 → pythonkuma-0.0.0rc2}/pythonkuma/__init__.py +1 -1
- {pythonkuma-0.0.0rc1 → pythonkuma-0.0.0rc2}/pythonkuma/models.py +23 -22
- {pythonkuma-0.0.0rc1 → pythonkuma-0.0.0rc2}/.gitignore +0 -0
- {pythonkuma-0.0.0rc1 → pythonkuma-0.0.0rc2}/LICENSE +0 -0
- {pythonkuma-0.0.0rc1 → pythonkuma-0.0.0rc2}/README.md +0 -0
- {pythonkuma-0.0.0rc1 → pythonkuma-0.0.0rc2}/pyproject.toml +0 -0
- {pythonkuma-0.0.0rc1 → pythonkuma-0.0.0rc2}/pythonkuma/const.py +0 -0
- {pythonkuma-0.0.0rc1 → pythonkuma-0.0.0rc2}/pythonkuma/decorator.py +0 -0
- {pythonkuma-0.0.0rc1 → pythonkuma-0.0.0rc2}/pythonkuma/exceptions.py +0 -0
- {pythonkuma-0.0.0rc1 → pythonkuma-0.0.0rc2}/pythonkuma/py.typed +0 -0
- {pythonkuma-0.0.0rc1 → pythonkuma-0.0.0rc2}/pythonkuma/uptimekuma.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pythonkuma
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.0rc2
|
|
4
4
|
Summary: Simple Python wrapper for Uptime Kuma
|
|
5
5
|
Project-URL: Source, https://github.com/tr4nt0r/pythonkuma
|
|
6
6
|
Author-email: Manfred Dennerlein Rodelo <manfred@dennerlein.name>, Jayakorn Karikan <jayakornk@gmail.com>
|
|
@@ -2,13 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from dataclasses import dataclass
|
|
6
|
-
from enum import StrEnum
|
|
5
|
+
from dataclasses import dataclass, field
|
|
6
|
+
from enum import IntEnum, StrEnum
|
|
7
7
|
from typing import Any
|
|
8
8
|
|
|
9
|
+
from mashumaro import DataClassDictMixin
|
|
9
10
|
from prometheus_client.parser import text_string_to_metric_families as parser
|
|
10
11
|
|
|
11
12
|
|
|
13
|
+
class MonitorStatus(IntEnum):
|
|
14
|
+
"""Monitor states."""
|
|
15
|
+
|
|
16
|
+
DOWN = 0
|
|
17
|
+
UP = 1
|
|
18
|
+
PENDING = 2
|
|
19
|
+
MAINTENANCE = 3
|
|
20
|
+
|
|
21
|
+
|
|
12
22
|
class MonitorType(StrEnum):
|
|
13
23
|
"""Monitors type."""
|
|
14
24
|
|
|
@@ -36,33 +46,24 @@ class MonitorType(StrEnum):
|
|
|
36
46
|
TAILSCALE_PING = "tailscale-ping"
|
|
37
47
|
|
|
38
48
|
|
|
39
|
-
|
|
49
|
+
@dataclass
|
|
50
|
+
class UptimeKumaBaseModel(DataClassDictMixin):
|
|
40
51
|
"""UptimeKumaBaseModel."""
|
|
41
52
|
|
|
42
53
|
|
|
43
|
-
@dataclass
|
|
54
|
+
@dataclass(kw_only=True)
|
|
44
55
|
class UptimeKumaMonitor(UptimeKumaBaseModel):
|
|
45
56
|
"""Monitor model for Uptime Kuma."""
|
|
46
57
|
|
|
47
|
-
monitor_cert_days_remaining:
|
|
48
|
-
monitor_cert_is_valid:
|
|
49
|
-
monitor_hostname: str = ""
|
|
50
|
-
monitor_name: str
|
|
51
|
-
monitor_port: str = ""
|
|
52
|
-
monitor_response_time:
|
|
53
|
-
monitor_status:
|
|
58
|
+
monitor_cert_days_remaining: int
|
|
59
|
+
monitor_cert_is_valid: bool
|
|
60
|
+
monitor_hostname: str | None = field(metadata={"deserialize": lambda v: None if v == "null" else v})
|
|
61
|
+
monitor_name: str
|
|
62
|
+
monitor_port: str | None = field(metadata={"deserialize": lambda v: None if v == "null" else v})
|
|
63
|
+
monitor_response_time: int = 0
|
|
64
|
+
monitor_status: MonitorStatus
|
|
54
65
|
monitor_type: MonitorType = MonitorType.HTTP
|
|
55
|
-
monitor_url: str = ""
|
|
56
|
-
|
|
57
|
-
@staticmethod
|
|
58
|
-
def from_dict(data: dict[str, Any]) -> UptimeKumaMonitor:
|
|
59
|
-
"""Generate object from json."""
|
|
60
|
-
obj: dict[str, Any] = {}
|
|
61
|
-
for key, value in data.items():
|
|
62
|
-
if hasattr(UptimeKumaMonitor, key):
|
|
63
|
-
obj[key] = MonitorType(value) if key == "monitor_type" else value
|
|
64
|
-
|
|
65
|
-
return UptimeKumaMonitor(**obj)
|
|
66
|
+
monitor_url: str | None = field(metadata={"deserialize": lambda v: None if v == "null" else v})
|
|
66
67
|
|
|
67
68
|
|
|
68
69
|
@dataclass
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|