tlnt-cli 1.8.0__tar.gz → 1.9.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.
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/PKG-INFO +4 -3
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/README.md +3 -2
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/pyproject.toml +1 -1
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/pyproject.toml.orig +1 -1
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/main.py +2 -1
- tlnt_cli-1.9.0/src/tlnt/core/mekari_status.py +62 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/play_store.py +4 -3
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/LICENSE +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/__init__.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/__main__.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/browser/__init__.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/browser/login.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/browser/oauth.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/browser/scripted.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/__init__.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/approvals.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/avatars.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/__init__.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/api.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/attendance.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/calendar.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/login.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/logout.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/notifications.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/overtime.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/payslip.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/profile.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/reimbursement.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/setup.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/status.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/timeoff.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/update.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/version.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/options.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/output.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/prompts.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/__init__.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/api_endpoints.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/client.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/config.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/curl.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/device.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/http_client.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/logs.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/mekari.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/models.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/__init__.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/api.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/attendance.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/calendar.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/device.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/login.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/logout.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/notifications.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/overtime.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/payslip.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/profile.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/setup.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/status.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/timeoff.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/session.py +0 -0
- {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/user_agent.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tlnt-cli
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.9.0
|
|
4
4
|
Summary: CLI wrapper for HRIS attendance and employment workflows.
|
|
5
5
|
Author: Fathiraz Arthuro
|
|
6
6
|
License-Expression: MIT
|
|
@@ -108,8 +108,9 @@ The full command map, global options and output modes are in
|
|
|
108
108
|
that output out of chat, logs and tickets.
|
|
109
109
|
- `TALENTA_READONLY=1` refuses every command that would change Talenta or
|
|
110
110
|
local state.
|
|
111
|
-
- The version checks only read public
|
|
112
|
-
send your session or config, and never log out, log
|
|
111
|
+
- The version and status checks only read public pages (PyPI, Google Play and
|
|
112
|
+
status.mekari.com), never send your session or config, and never log out, log
|
|
113
|
+
in, or update for you.
|
|
113
114
|
- Never print passwords, bearer tokens, cookies, authorization codes, request
|
|
114
115
|
bodies, selfie contents, or real employee data.
|
|
115
116
|
- If `status` returns `session_missing`, `session_invalid`,
|
|
@@ -91,8 +91,9 @@ The full command map, global options and output modes are in
|
|
|
91
91
|
that output out of chat, logs and tickets.
|
|
92
92
|
- `TALENTA_READONLY=1` refuses every command that would change Talenta or
|
|
93
93
|
local state.
|
|
94
|
-
- The version checks only read public
|
|
95
|
-
send your session or config, and never log out, log
|
|
94
|
+
- The version and status checks only read public pages (PyPI, Google Play and
|
|
95
|
+
status.mekari.com), never send your session or config, and never log out, log
|
|
96
|
+
in, or update for you.
|
|
96
97
|
- Never print passwords, bearer tokens, cookies, authorization codes, request
|
|
97
98
|
bodies, selfie contents, or real employee data.
|
|
98
99
|
- If `status` returns `session_missing`, `session_invalid`,
|
|
@@ -54,7 +54,7 @@ from tlnt.cli.commands import update as update_command
|
|
|
54
54
|
from tlnt.cli.commands.update import update
|
|
55
55
|
from tlnt.cli.commands.version import print_version
|
|
56
56
|
from tlnt.cli.options import VerboseOption
|
|
57
|
-
from tlnt.core import config, play_store
|
|
57
|
+
from tlnt.core import config, mekari_status, play_store
|
|
58
58
|
from tlnt.core import mekari as mekari_constants
|
|
59
59
|
from tlnt.core.curl import CurlPreview
|
|
60
60
|
from tlnt.core.logs import configure_logging
|
|
@@ -191,6 +191,7 @@ def main_callback(
|
|
|
191
191
|
for warning in (
|
|
192
192
|
update_command.update_warning(),
|
|
193
193
|
play_store.app_version_warning(mekari_constants.app_version()),
|
|
194
|
+
mekari_status.mekari_status_warning(),
|
|
194
195
|
):
|
|
195
196
|
if warning:
|
|
196
197
|
typer.echo(warning, err=True)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""Down Talenta and SSO monitors on status.mekari.com, cached for one hour."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from tlnt.core import play_store
|
|
10
|
+
|
|
11
|
+
STATUS_PAGE_URL = "https://status.mekari.com/"
|
|
12
|
+
# The page is UptimeRobot's; this is the JSON its own front end reads.
|
|
13
|
+
MONITOR_LIST_URL = "https://status.mekari.com/api/getMonitorList/6WAJXFo5EE"
|
|
14
|
+
# tlnt calls api.mekari.com/internal/talenta-mobile and signs in through
|
|
15
|
+
# account.mekari.com; no other monitor on the page maps to a host tlnt uses.
|
|
16
|
+
WATCHED_MONITORS = frozenset(
|
|
17
|
+
{
|
|
18
|
+
"Talenta - Core",
|
|
19
|
+
"Talenta - API Mobile",
|
|
20
|
+
"Talenta - API Mobile Internal",
|
|
21
|
+
"Platform - SSO",
|
|
22
|
+
}
|
|
23
|
+
)
|
|
24
|
+
_NOT_DOWN = frozenset({"success", "paused"})
|
|
25
|
+
_FETCH_TIMEOUT_SECONDS = 3
|
|
26
|
+
_CACHE_TTL_SECONDS = 60 * 60
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _describe(monitor: dict[str, Any]) -> str:
|
|
30
|
+
since = (monitor.get("lastDowntime") or {}).get("date")
|
|
31
|
+
# ponytail: WIB is hardcoded because the page reports psp.timezone +07:00;
|
|
32
|
+
# read it from the payload if the page ever changes zone.
|
|
33
|
+
return f"{monitor['name']} (since {since[:16]} WIB)" if since else monitor["name"]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def parse_down_services(payload: Any) -> str | None:
|
|
37
|
+
# ponytail: first page only (perPage 30, 10 monitors today); page through
|
|
38
|
+
# the list if the page ever grows past that.
|
|
39
|
+
items = [
|
|
40
|
+
_describe(monitor)
|
|
41
|
+
for monitor in payload["psp"]["monitors"]
|
|
42
|
+
if monitor["name"] in WATCHED_MONITORS and monitor["statusClass"] not in _NOT_DOWN
|
|
43
|
+
]
|
|
44
|
+
return ", ".join(items) or None
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def fetch_down_services() -> str | None:
|
|
48
|
+
try:
|
|
49
|
+
response = httpx.get(MONITOR_LIST_URL, timeout=_FETCH_TIMEOUT_SECONDS, follow_redirects=True)
|
|
50
|
+
response.raise_for_status()
|
|
51
|
+
return parse_down_services(response.json())
|
|
52
|
+
except (httpx.HTTPError, ValueError, LookupError, TypeError, AttributeError):
|
|
53
|
+
return None
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def mekari_status_warning(now: float | None = None) -> str | None:
|
|
57
|
+
down = play_store.cached_version(
|
|
58
|
+
"mekari_status.json", fetch_down_services, now, ttl_seconds=_CACHE_TTL_SECONDS
|
|
59
|
+
)
|
|
60
|
+
if not down:
|
|
61
|
+
return None
|
|
62
|
+
return f"⚠️ status.mekari.com reports down: {down}. See {STATUS_PAGE_URL}"
|
|
@@ -40,11 +40,12 @@ def cached_version(
|
|
|
40
40
|
cache_name: str,
|
|
41
41
|
fetch: Callable[[], str | None],
|
|
42
42
|
now: float | None = None,
|
|
43
|
+
ttl_seconds: float = _CACHE_TTL_SECONDS,
|
|
43
44
|
) -> str | None:
|
|
44
|
-
"""Return a
|
|
45
|
+
"""Return a value cached for ttl_seconds (default 24 hours) in the user cache dir, else fetch it.
|
|
45
46
|
|
|
46
47
|
A failed lookup is cached too, so a blocked or slow site costs one
|
|
47
|
-
timeout
|
|
48
|
+
timeout per ttl instead of one per command.
|
|
48
49
|
"""
|
|
49
50
|
now = time.time() if now is None else now
|
|
50
51
|
path = _cache_path(cache_name)
|
|
@@ -52,7 +53,7 @@ def cached_version(
|
|
|
52
53
|
cached = json.loads(path.read_text(encoding="utf-8"))
|
|
53
54
|
version = cached["version"]
|
|
54
55
|
if (version is None or isinstance(version, str)) and (
|
|
55
|
-
now - float(cached["checked_at"]) <
|
|
56
|
+
now - float(cached["checked_at"]) < ttl_seconds
|
|
56
57
|
):
|
|
57
58
|
return version
|
|
58
59
|
except (OSError, ValueError, KeyError, TypeError):
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|