The Kuma account has two-factor login, so the password login from #53 would always end in tokenRequired. Prod config.json now holds a Kuma session token instead: uptime_kuma = {url, token, maintenance_id: 7}.
Changes (kuma.py)
Sign in with loginByToken. A refusal is reported as "token rejected (Kuma password changed?)". username and password remain as a fallback for an account without two-factor login; with 2FA that path now says to use the token.
Wait for Kuma's first info event before emitting anything. Kuma registers its handlers only after sending info, so an earlier emit is silently dropped and times out now and then. If info doesn't arrive within the timeout, the error is "Kuma not ready".
configured() needs url, maintenance_id, and a token (or username and password).
README: the config row for the new key.
pauseMaintenance and resumeMaintenance with an int id, returning {ok, msg}, are confirmed correct on Kuma 2.5.5.
Tested
From prod (as www-data, with the branch's kuma.py) against Kuma 2.5.5: signed in by token and paused window 7, which was already paused, so nothing changed. Window 7 is still inactive.
603 tests pass (new: token sign-in, rejected token, nothing sent before info, password fallback, 2FA message). flake8 and bandit are clean.
## Why
The Kuma account has two-factor login, so the password login from #53 would always end in `tokenRequired`. Prod `config.json` now holds a Kuma session token instead: `uptime_kuma = {url, token, maintenance_id: 7}`.
## Changes (`kuma.py`)
- **Sign in with `loginByToken`.** A refusal is reported as "token rejected (Kuma password changed?)". `username` and `password` remain as a fallback for an account without two-factor login; with 2FA that path now says to use the token.
- **Wait for Kuma's first `info` event before emitting anything.** Kuma registers its handlers only after sending `info`, so an earlier emit is silently dropped and times out now and then. If `info` doesn't arrive within the timeout, the error is "Kuma not ready".
- **`configured()`** needs `url`, `maintenance_id`, and a token (or username and password).
- **README**: the config row for the new key.
`pauseMaintenance` and `resumeMaintenance` with an int id, returning `{ok, msg}`, are confirmed correct on Kuma 2.5.5.
## Tested
- From prod (as www-data, with the branch's `kuma.py`) against Kuma 2.5.5: signed in by token and paused window 7, which was already paused, so nothing changed. Window 7 is still inactive.
- 603 tests pass (new: token sign-in, rejected token, nothing sent before `info`, password fallback, 2FA message). flake8 and bandit are clean.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
The Kuma account has two-factor login, so a password login always ends
in tokenRequired. Prod config now holds a Kuma session token instead
(uptime_kuma = {url, token, maintenance_id}).
- Sign in with loginByToken; a refusal says the token was rejected
(Kuma password changed?). username/password stay as a fallback for an
account without two-factor login.
- Wait for Kuma's first 'info' event before emitting: Kuma registers
its handlers only after sending it, so an earlier emit is dropped and
times out now and then.
- configured() needs url, maintenance_id and a token (or username and
password).
Tested from prod against Kuma 2.5.5: signed in and paused window 7,
which was already paused.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jared
scheduled this pull request to auto merge when all checks succeed 2026-11-19 21:01:55 -05:00
jared
merged commit 54c5fb52c4 into main2026-11-19 21:01:57 -05:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Why
The Kuma account has two-factor login, so the password login from #53 would always end in
tokenRequired. Prodconfig.jsonnow holds a Kuma session token instead:uptime_kuma = {url, token, maintenance_id: 7}.Changes (
kuma.py)loginByToken. A refusal is reported as "token rejected (Kuma password changed?)".usernameandpasswordremain as a fallback for an account without two-factor login; with 2FA that path now says to use the token.infoevent before emitting anything. Kuma registers its handlers only after sendinginfo, so an earlier emit is silently dropped and times out now and then. Ifinfodoesn't arrive within the timeout, the error is "Kuma not ready".configured()needsurl,maintenance_id, and a token (or username and password).pauseMaintenanceandresumeMaintenancewith an int id, returning{ok, msg}, are confirmed correct on Kuma 2.5.5.Tested
kuma.py) against Kuma 2.5.5: signed in by token and paused window 7, which was already paused, so nothing changed. Window 7 is still inactive.info, password fallback, 2FA message). flake8 and bandit are clean.🤖 Generated with Claude Code
The Kuma account has two-factor login, so a password login always ends in tokenRequired. Prod config now holds a Kuma session token instead (uptime_kuma = {url, token, maintenance_id}). - Sign in with loginByToken; a refusal says the token was rejected (Kuma password changed?). username/password stay as a fallback for an account without two-factor login. - Wait for Kuma's first 'info' event before emitting: Kuma registers its handlers only after sending it, so an earlier emit is dropped and times out now and then. - configured() needs url, maintenance_id and a token (or username and password). Tested from prod against Kuma 2.5.5: signed in and paused window 7, which was already paused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>