pythonkuma 0.4.1__tar.gz → 0.5.1__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.4.1 → pythonkuma-0.5.1}/PKG-INFO +2 -3
- {pythonkuma-0.4.1 → pythonkuma-0.5.1}/README.md +1 -2
- {pythonkuma-0.4.1 → pythonkuma-0.5.1}/pyproject.toml +20 -7
- {pythonkuma-0.4.1 → pythonkuma-0.5.1}/pythonkuma/__init__.py +3 -1
- {pythonkuma-0.4.1 → pythonkuma-0.5.1}/pythonkuma/models.py +31 -21
- {pythonkuma-0.4.1 → pythonkuma-0.5.1}/pythonkuma/uptimekuma.py +18 -1
- {pythonkuma-0.4.1 → pythonkuma-0.5.1}/.gitignore +0 -0
- {pythonkuma-0.4.1 → pythonkuma-0.5.1}/LICENSE +0 -0
- {pythonkuma-0.4.1 → pythonkuma-0.5.1}/pythonkuma/exceptions.py +0 -0
- {pythonkuma-0.4.1 → pythonkuma-0.5.1}/pythonkuma/py.typed +0 -0
- {pythonkuma-0.4.1 → pythonkuma-0.5.1}/pythonkuma/update.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pythonkuma
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.1
|
|
4
4
|
Summary: Simple Python wrapper for Uptime Kuma
|
|
5
5
|
Project-URL: Source, https://github.com/tr4nt0r/pythonkuma
|
|
6
6
|
Project-URL: Documentation, https://tr4nt0r.github.io/pythonkuma
|
|
@@ -20,10 +20,9 @@ Description-Content-Type: text/markdown
|
|
|
20
20
|
Simple Python wrapper for Uptime Kuma
|
|
21
21
|
|
|
22
22
|
[](https://github.com/tr4nt0r/pythonkuma/actions)
|
|
23
|
-
[](https://codecov.io/gh/tr4nt0r/pythonkuma)
|
|
24
24
|
[](https://badge.fury.io/py/pythonkuma)
|
|
25
25
|

|
|
26
|
-
[](https://www.buymeacoffee.com/tr4nt0r)
|
|
27
26
|
[](https://github.com/sponsors/tr4nt0r)
|
|
28
27
|
|
|
29
28
|
---
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
Simple Python wrapper for Uptime Kuma
|
|
4
4
|
|
|
5
5
|
[](https://github.com/tr4nt0r/pythonkuma/actions)
|
|
6
|
-
[](https://codecov.io/gh/tr4nt0r/pythonkuma)
|
|
7
7
|
[](https://badge.fury.io/py/pythonkuma)
|
|
8
8
|

|
|
9
|
-
[](https://www.buymeacoffee.com/tr4nt0r)
|
|
10
9
|
[](https://github.com/sponsors/tr4nt0r)
|
|
11
10
|
|
|
12
11
|
---
|
|
@@ -37,19 +37,26 @@ include = [
|
|
|
37
37
|
"/pythonkuma",
|
|
38
38
|
]
|
|
39
39
|
|
|
40
|
+
[[tool.hatch.envs.hatch-test.matrix]]
|
|
41
|
+
python = ["3.14", "3.13", "3.12"]
|
|
42
|
+
|
|
40
43
|
[tool.hatch.envs.default]
|
|
41
44
|
dependencies = [
|
|
42
|
-
"ruff==0.15.
|
|
43
|
-
"aiohttp==3.13.
|
|
44
|
-
"prometheus-client==0.
|
|
45
|
+
"ruff==0.15.12",
|
|
46
|
+
"aiohttp==3.13.5",
|
|
47
|
+
"prometheus-client==0.25.0",
|
|
45
48
|
"mashumaro==3.20",
|
|
46
|
-
"mkdocs-material==9.7.
|
|
47
|
-
"mkdocstrings[python]==1.0.
|
|
49
|
+
"mkdocs-material==9.7.6",
|
|
50
|
+
"mkdocstrings[python]==1.0.4",
|
|
51
|
+
"pytest-asyncio==1.3.0",
|
|
52
|
+
"pytest==9.0.3",
|
|
53
|
+
"pytest-cov==7.1.0",
|
|
54
|
+
"syrupy==5.1.0",
|
|
48
55
|
]
|
|
49
56
|
|
|
50
57
|
[tool.hatch.envs.hatch-static-analysis]
|
|
51
58
|
dependencies = [
|
|
52
|
-
"ruff==0.15.
|
|
59
|
+
"ruff==0.15.12",
|
|
53
60
|
]
|
|
54
61
|
config-path = "none"
|
|
55
62
|
|
|
@@ -62,8 +69,11 @@ pythonpath = ["pythonkuma"]
|
|
|
62
69
|
|
|
63
70
|
[tool.hatch.envs.hatch-test]
|
|
64
71
|
extra-dependencies = [
|
|
65
|
-
"pytest-cov==7.
|
|
72
|
+
"pytest-cov==7.1.0",
|
|
73
|
+
"pytest-asyncio==1.3.0",
|
|
74
|
+
"syrupy==5.1.0",
|
|
66
75
|
]
|
|
76
|
+
extra-args = ["--cov-report=xml", "-vv"]
|
|
67
77
|
|
|
68
78
|
[tool.hatch.envs.default.scripts]
|
|
69
79
|
docs-serve = "mkdocs serve"
|
|
@@ -83,6 +93,9 @@ indent-style = "space"
|
|
|
83
93
|
select = ["ALL"]
|
|
84
94
|
ignore = ["TRY003", "COM812", "N818", "C901"]
|
|
85
95
|
|
|
96
|
+
[tool.ruff.lint.per-file-ignores]
|
|
97
|
+
"tests/*" = ["S101", "TC002", "TC003"]
|
|
98
|
+
|
|
86
99
|
[lint.per-file-ignores]
|
|
87
100
|
"**/scripts/*" = [
|
|
88
101
|
"INP001",
|
|
@@ -5,12 +5,13 @@ from .exceptions import (
|
|
|
5
5
|
UptimeKumaAuthenticationException,
|
|
6
6
|
UptimeKumaConnectionException,
|
|
7
7
|
UptimeKumaException,
|
|
8
|
+
UptimeKumaParseException,
|
|
8
9
|
)
|
|
9
10
|
from .models import MonitorStatus, MonitorType, UptimeKumaMonitor, UptimeKumaVersion
|
|
10
11
|
from .update import UpdateChecker
|
|
11
12
|
from .uptimekuma import UptimeKuma
|
|
12
13
|
|
|
13
|
-
__version__ = "0.
|
|
14
|
+
__version__ = "0.5.1"
|
|
14
15
|
|
|
15
16
|
__all__ = [
|
|
16
17
|
"MonitorStatus",
|
|
@@ -22,5 +23,6 @@ __all__ = [
|
|
|
22
23
|
"UptimeKumaConnectionException",
|
|
23
24
|
"UptimeKumaException",
|
|
24
25
|
"UptimeKumaMonitor",
|
|
26
|
+
"UptimeKumaParseException",
|
|
25
27
|
"UptimeKumaVersion",
|
|
26
28
|
]
|
|
@@ -21,37 +21,45 @@ class MonitorStatus(IntEnum):
|
|
|
21
21
|
class MonitorType(StrEnum):
|
|
22
22
|
"""Monitors type."""
|
|
23
23
|
|
|
24
|
+
# General monitor type
|
|
24
25
|
HTTP = "http"
|
|
26
|
+
KEYWORD = "keyword"
|
|
25
27
|
PORT = "port"
|
|
26
28
|
PING = "ping"
|
|
27
|
-
KEYWORD = "keyword"
|
|
28
29
|
DNS = "dns"
|
|
29
|
-
PUSH = "push"
|
|
30
|
-
STEAM = "steam"
|
|
31
|
-
MQTT = "mqtt"
|
|
32
|
-
SQLSERVER = "sqlserver"
|
|
33
|
-
JSON_QUERY = "json-query"
|
|
34
|
-
GROUP = "group"
|
|
35
30
|
DOCKER = "docker"
|
|
36
|
-
|
|
31
|
+
SYSTEM_SERVICE = "system-service"
|
|
37
32
|
REAL_BROWSER = "real-browser"
|
|
38
|
-
|
|
33
|
+
# Special
|
|
34
|
+
GROUP = "group"
|
|
35
|
+
# Passive monitor type
|
|
36
|
+
PUSH = "push"
|
|
37
|
+
MANUAL = "manual"
|
|
38
|
+
# Specific monitor type
|
|
39
|
+
GLOBALPING = "globalping"
|
|
40
|
+
GRPC_KEYWORD = "grpc-keyword"
|
|
41
|
+
JSON_QUERY = "json-query"
|
|
39
42
|
KAFKA_PRODUCER = "kafka-producer"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
RADIUS = "radius"
|
|
44
|
-
REDIS = "redis"
|
|
45
|
-
TAILSCALE_PING = "tailscale-ping"
|
|
43
|
+
MQTT = "mqtt"
|
|
44
|
+
RABBIT_MQ = "rabbitmq"
|
|
45
|
+
SIP_OPTIONS = "sip-options"
|
|
46
46
|
SMTP = "smtp"
|
|
47
47
|
SNMP = "snmp"
|
|
48
|
-
|
|
49
|
-
MANUAL = "manual"
|
|
50
|
-
UNKNOWN = "unknown"
|
|
48
|
+
TAILSCALE_PING = "tailscale-ping"
|
|
51
49
|
WEBSOCKET_UPGRADE = "websocket-upgrade"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
# Database monitor type
|
|
51
|
+
SQLSERVER = "sqlserver"
|
|
52
|
+
MONGODB = "mongodb"
|
|
53
|
+
MYSQL = "mysql"
|
|
54
|
+
ORACLEDB = "oracledb"
|
|
55
|
+
POSTGRES = "postgres"
|
|
56
|
+
REDIS = "redis"
|
|
57
|
+
RADIUS = "radius"
|
|
58
|
+
# Game server
|
|
59
|
+
GAMEDIG = "gamedig"
|
|
60
|
+
STEAM = "steam"
|
|
61
|
+
# other
|
|
62
|
+
UNKNOWN = "unknown"
|
|
55
63
|
|
|
56
64
|
@classmethod
|
|
57
65
|
def _missing_(cls, _: object) -> Self:
|
|
@@ -92,6 +100,8 @@ class UptimeKumaMonitor(UptimeKumaBaseModel):
|
|
|
92
100
|
monitor_response_time_seconds_30d: float | None = None
|
|
93
101
|
monitor_response_time_seconds_365d: float | None = None
|
|
94
102
|
|
|
103
|
+
monitor_tags: list[str]
|
|
104
|
+
|
|
95
105
|
|
|
96
106
|
@dataclass
|
|
97
107
|
class UptimeKumaVersion(UptimeKumaBaseModel):
|
|
@@ -20,6 +20,16 @@ from .exceptions import (
|
|
|
20
20
|
)
|
|
21
21
|
from .models import UptimeKumaMonitor, UptimeKumaVersion
|
|
22
22
|
|
|
23
|
+
COMMON_LABELS = (
|
|
24
|
+
"monitor_id",
|
|
25
|
+
"monitor_name",
|
|
26
|
+
"monitor_type",
|
|
27
|
+
"monitor_url",
|
|
28
|
+
"monitor_hostname",
|
|
29
|
+
"monitor_port",
|
|
30
|
+
"window",
|
|
31
|
+
)
|
|
32
|
+
|
|
23
33
|
|
|
24
34
|
class UptimeKuma:
|
|
25
35
|
"""Uptime Kuma client."""
|
|
@@ -111,13 +121,20 @@ class UptimeKuma:
|
|
|
111
121
|
else sample.labels["monitor_name"]
|
|
112
122
|
)
|
|
113
123
|
|
|
124
|
+
tags = [
|
|
125
|
+
f"{k}:{v}" if v else k
|
|
126
|
+
for k, v in sample.labels.items()
|
|
127
|
+
if k not in COMMON_LABELS
|
|
128
|
+
]
|
|
114
129
|
name = (
|
|
115
130
|
f"{sample.name}_{window}"
|
|
116
131
|
if (window := sample.labels.get("window"))
|
|
117
132
|
else sample.name
|
|
118
133
|
)
|
|
119
134
|
|
|
120
|
-
monitors.setdefault(
|
|
135
|
+
monitors.setdefault(
|
|
136
|
+
key, {**sample.labels, "monitor_tags": tags}
|
|
137
|
+
).update({name: sample.value})
|
|
121
138
|
|
|
122
139
|
return {
|
|
123
140
|
key: UptimeKumaMonitor.from_dict(value) for key, value in monitors.items()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|