pythonkuma 0.2.0rc1__tar.gz → 0.3.0__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.2.0rc1 → pythonkuma-0.3.0}/PKG-INFO +1 -8
- {pythonkuma-0.2.0rc1 → pythonkuma-0.3.0}/pyproject.toml +8 -14
- {pythonkuma-0.2.0rc1 → pythonkuma-0.3.0}/pythonkuma/__init__.py +5 -1
- {pythonkuma-0.2.0rc1 → pythonkuma-0.3.0}/pythonkuma/exceptions.py +4 -0
- {pythonkuma-0.2.0rc1 → pythonkuma-0.3.0}/pythonkuma/models.py +4 -0
- pythonkuma-0.3.0/pythonkuma/update.py +52 -0
- {pythonkuma-0.2.0rc1 → pythonkuma-0.3.0}/.gitignore +0 -0
- {pythonkuma-0.2.0rc1 → pythonkuma-0.3.0}/LICENSE +0 -0
- {pythonkuma-0.2.0rc1 → pythonkuma-0.3.0}/README.md +0 -0
- {pythonkuma-0.2.0rc1 → pythonkuma-0.3.0}/pythonkuma/py.typed +0 -0
- {pythonkuma-0.2.0rc1 → pythonkuma-0.3.0}/pythonkuma/uptimekuma.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pythonkuma
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
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
|
|
@@ -13,13 +13,6 @@ Requires-Python: >=3.12
|
|
|
13
13
|
Requires-Dist: aiohttp>=3.12.9
|
|
14
14
|
Requires-Dist: mashumaro>=3.13.1
|
|
15
15
|
Requires-Dist: prometheus-client>=0.21.0
|
|
16
|
-
Provides-Extra: dev
|
|
17
|
-
Requires-Dist: aiohttp==3.12.12; extra == 'dev'
|
|
18
|
-
Requires-Dist: mashumaro==3.16; extra == 'dev'
|
|
19
|
-
Requires-Dist: mkdocs-material==9.6.9; extra == 'dev'
|
|
20
|
-
Requires-Dist: mkdocstrings[python]==0.29.0; extra == 'dev'
|
|
21
|
-
Requires-Dist: prometheus-client==0.22.1; extra == 'dev'
|
|
22
|
-
Requires-Dist: ruff==0.11.13; extra == 'dev'
|
|
23
16
|
Description-Content-Type: text/markdown
|
|
24
17
|
|
|
25
18
|
# pythonkuma
|
|
@@ -23,16 +23,6 @@ dependencies = [
|
|
|
23
23
|
"mashumaro>=3.13.1",
|
|
24
24
|
]
|
|
25
25
|
|
|
26
|
-
[project.optional-dependencies]
|
|
27
|
-
dev = [
|
|
28
|
-
"ruff==0.11.13",
|
|
29
|
-
"aiohttp==3.12.12",
|
|
30
|
-
"prometheus-client==0.22.1",
|
|
31
|
-
"mashumaro==3.16",
|
|
32
|
-
"mkdocs-material==9.6.9",
|
|
33
|
-
"mkdocstrings[python]==0.29.0",
|
|
34
|
-
]
|
|
35
|
-
|
|
36
26
|
[project.urls]
|
|
37
27
|
Source = "https://github.com/tr4nt0r/pythonkuma"
|
|
38
28
|
Documentation = "https://tr4nt0r.github.io/pythonkuma"
|
|
@@ -49,12 +39,17 @@ include = [
|
|
|
49
39
|
|
|
50
40
|
[tool.hatch.envs.default]
|
|
51
41
|
dependencies = [
|
|
52
|
-
"
|
|
42
|
+
"ruff==0.12.2",
|
|
43
|
+
"aiohttp==3.12.13",
|
|
44
|
+
"prometheus-client==0.22.1",
|
|
45
|
+
"mashumaro==3.16",
|
|
46
|
+
"mkdocs-material==9.6.15",
|
|
47
|
+
"mkdocstrings[python]==0.29.1",
|
|
53
48
|
]
|
|
54
49
|
|
|
55
50
|
[tool.hatch.envs.hatch-static-analysis]
|
|
56
51
|
dependencies = [
|
|
57
|
-
"ruff==0.
|
|
52
|
+
"ruff==0.12.2",
|
|
58
53
|
]
|
|
59
54
|
config-path = "ruff.toml"
|
|
60
55
|
|
|
@@ -67,8 +62,7 @@ pythonpath = ["pythonkuma"]
|
|
|
67
62
|
|
|
68
63
|
[tool.hatch.envs.hatch-test]
|
|
69
64
|
extra-dependencies = [
|
|
70
|
-
"
|
|
71
|
-
"pytest-cov==6.1.1",
|
|
65
|
+
"pytest-cov==6.2.1",
|
|
72
66
|
]
|
|
73
67
|
|
|
74
68
|
[tool.hatch.envs.default.scripts]
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
"""Python API wrapper for Uptime Kuma."""
|
|
2
2
|
|
|
3
3
|
from .exceptions import (
|
|
4
|
+
UpdateException,
|
|
4
5
|
UptimeKumaAuthenticationException,
|
|
5
6
|
UptimeKumaConnectionException,
|
|
6
7
|
UptimeKumaException,
|
|
7
8
|
)
|
|
8
9
|
from .models import MonitorStatus, MonitorType, UptimeKumaMonitor, UptimeKumaVersion
|
|
10
|
+
from .update import UpdateChecker
|
|
9
11
|
from .uptimekuma import UptimeKuma
|
|
10
12
|
|
|
11
|
-
__version__ = "0.
|
|
13
|
+
__version__ = "0.3.0"
|
|
12
14
|
|
|
13
15
|
__all__ = [
|
|
14
16
|
"MonitorStatus",
|
|
15
17
|
"MonitorType",
|
|
18
|
+
"UpdateChecker",
|
|
19
|
+
"UpdateException",
|
|
16
20
|
"UptimeKuma",
|
|
17
21
|
"UptimeKumaAuthenticationException",
|
|
18
22
|
"UptimeKumaConnectionException",
|
|
@@ -11,3 +11,7 @@ class UptimeKumaConnectionException(UptimeKumaException):
|
|
|
11
11
|
|
|
12
12
|
class UptimeKumaAuthenticationException(UptimeKumaException):
|
|
13
13
|
"""Uptime Kuma authentication exception."""
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class UpdateException(Exception):
|
|
17
|
+
"""Exception raised for errors fetching latest release from github."""
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""Check for latest Uptime Kuma release."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
|
|
7
|
+
from aiohttp import ClientError, ClientSession
|
|
8
|
+
from yarl import URL
|
|
9
|
+
|
|
10
|
+
from .exceptions import UpdateException
|
|
11
|
+
|
|
12
|
+
BASE_URL = URL("https://api.github.com/repos/louislam/uptime-kuma")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclass(kw_only=True)
|
|
16
|
+
class LatestRelease:
|
|
17
|
+
"""Latest release data."""
|
|
18
|
+
|
|
19
|
+
tag_name: str
|
|
20
|
+
name: str
|
|
21
|
+
html_url: str
|
|
22
|
+
body: str
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class UpdateChecker:
|
|
26
|
+
"""Check for Uptime Kuma updates."""
|
|
27
|
+
|
|
28
|
+
def __init__(
|
|
29
|
+
self,
|
|
30
|
+
session: ClientSession,
|
|
31
|
+
) -> None:
|
|
32
|
+
"""Initialize Uptime Kuma release checker."""
|
|
33
|
+
self._session = session
|
|
34
|
+
|
|
35
|
+
async def latest_release(self) -> LatestRelease:
|
|
36
|
+
"""Fetch latest IronOS release."""
|
|
37
|
+
url = BASE_URL / "releases/latest"
|
|
38
|
+
try:
|
|
39
|
+
async with self._session.get(url) as response:
|
|
40
|
+
data = await response.json()
|
|
41
|
+
return LatestRelease(
|
|
42
|
+
tag_name=data["tag_name"],
|
|
43
|
+
name=data["name"],
|
|
44
|
+
html_url=data["html_url"],
|
|
45
|
+
body=data["body"],
|
|
46
|
+
)
|
|
47
|
+
except ClientError as e:
|
|
48
|
+
msg = "Failed to fetch latest Uptime Kuma release from Github"
|
|
49
|
+
raise UpdateException(msg) from e
|
|
50
|
+
except KeyError as e:
|
|
51
|
+
msg = "Failed to parse latest Uptime Kuma release from Github response"
|
|
52
|
+
raise UpdateException(msg) from e
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|