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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pythonkuma
3
- Version: 0.4.1
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
  [![build](https://github.com/tr4nt0r/pythonkuma/workflows/Build/badge.svg)](https://github.com/tr4nt0r/pythonkuma/actions)
23
- [![codecov](https://codecov.io/gh/tr4nt0r/pythonkuma/graph/badge.svg?token=RM3MC4LP07)](https://codecov.io/gh/pythonkuma/pynecil)
23
+ [![codecov](https://codecov.io/gh/tr4nt0r/pythonkuma/graph/badge.svg?token=YmUNsziQH0)](https://codecov.io/gh/tr4nt0r/pythonkuma)
24
24
  [![PyPI version](https://badge.fury.io/py/pythonkuma.svg)](https://badge.fury.io/py/pythonkuma)
25
25
  ![PyPI - Downloads](https://img.shields.io/pypi/dm/pythonkuma?style=flat&label=pypi%20downloads)
26
- [!["Buy Me A Coffee"](https://img.shields.io/badge/-buy_me_a%C2%A0coffee-gray?logo=buy-me-a-coffee)](https://www.buymeacoffee.com/tr4nt0r)
27
26
  [![GitHub Sponsor](https://img.shields.io/badge/GitHub-Sponsor-blue?logo=github)](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
  [![build](https://github.com/tr4nt0r/pythonkuma/workflows/Build/badge.svg)](https://github.com/tr4nt0r/pythonkuma/actions)
6
- [![codecov](https://codecov.io/gh/tr4nt0r/pythonkuma/graph/badge.svg?token=RM3MC4LP07)](https://codecov.io/gh/pythonkuma/pynecil)
6
+ [![codecov](https://codecov.io/gh/tr4nt0r/pythonkuma/graph/badge.svg?token=YmUNsziQH0)](https://codecov.io/gh/tr4nt0r/pythonkuma)
7
7
  [![PyPI version](https://badge.fury.io/py/pythonkuma.svg)](https://badge.fury.io/py/pythonkuma)
8
8
  ![PyPI - Downloads](https://img.shields.io/pypi/dm/pythonkuma?style=flat&label=pypi%20downloads)
9
- [!["Buy Me A Coffee"](https://img.shields.io/badge/-buy_me_a%C2%A0coffee-gray?logo=buy-me-a-coffee)](https://www.buymeacoffee.com/tr4nt0r)
10
9
  [![GitHub Sponsor](https://img.shields.io/badge/GitHub-Sponsor-blue?logo=github)](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.0",
43
- "aiohttp==3.13.3",
44
- "prometheus-client==0.24.1",
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.1",
47
- "mkdocstrings[python]==1.0.3",
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.0",
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.0.0",
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.4.1"
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
- GRPC_KEYWORD = "grpc-keyword"
31
+ SYSTEM_SERVICE = "system-service"
37
32
  REAL_BROWSER = "real-browser"
38
- GAMEDIG = "gamedig"
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
- POSTGRES = "postgres"
41
- MYSQL = "mysql"
42
- MONGODB = "mongodb"
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
- RABBIT_MQ = "rabbitmq"
49
- MANUAL = "manual"
50
- UNKNOWN = "unknown"
48
+ TAILSCALE_PING = "tailscale-ping"
51
49
  WEBSOCKET_UPGRADE = "websocket-upgrade"
52
- SYSTEM_SERVICE = "system-service"
53
- GLOBALPING = "globalping"
54
- SIP_OPTIONS = "sip-options"
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(key, sample.labels).update({name: sample.value})
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