e-note-ion 2.0.0__tar.gz → 2.1.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.
- {e_note_ion-2.0.0/e_note_ion.egg-info → e_note_ion-2.1.0}/PKG-INFO +8 -1
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/README.md +7 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0/e_note_ion.egg-info}/PKG-INFO +8 -1
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/health.py +12 -3
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/bart.py +16 -1
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/discogs.py +14 -1
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/http.py +22 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/parcel.py +10 -1
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/tmdb.py +14 -1
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/uptimerobot.py +15 -1
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/ynab.py +10 -1
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/pyproject.toml +1 -1
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/scheduler.py +12 -1
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/LICENSE.txt +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/MANIFEST.in +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/config.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/e_note_ion.egg-info/SOURCES.txt +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/e_note_ion.egg-info/dependency_links.txt +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/e_note_ion.egg-info/entry_points.txt +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/e_note_ion.egg-info/requires.txt +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/e_note_ion.egg-info/top_level.txt +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/exceptions.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/healthalert.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/homebridge.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/__init__.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/calendar.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/calendar_schedule.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/color.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/diving.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/google.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/media.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/message.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/moon.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/morning.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/notion.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/plex.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/qbittorrent.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/scheduler.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/trakt.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/unraid.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/vestaboard.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/weather.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/integrations/youtube.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/public.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/quiet.py +0 -0
- {e_note_ion-2.0.0 → e_note_ion-2.1.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: e-note-ion
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: Automation for Vestaboard displays — with emotion
|
|
5
5
|
Author-email: Jason Puglisi <jason@pugli.si>
|
|
6
6
|
Maintainer-email: Jason Puglisi <jason@pugli.si>
|
|
@@ -194,6 +194,13 @@ See `config.example.toml` for the full keyword grammar and edge cases.
|
|
|
194
194
|
|
|
195
195
|
## Health monitoring
|
|
196
196
|
|
|
197
|
+
Credentials are validated once at startup. An integration whose key the service
|
|
198
|
+
rejects (HTTP 401/403) is marked unhealthy immediately and shows on `/health`,
|
|
199
|
+
rather than staying silent until its cron next fires — up to a day later for the
|
|
200
|
+
daily ones. Startup continues either way: one expired token does not take the
|
|
201
|
+
board down.
|
|
202
|
+
|
|
203
|
+
|
|
197
204
|
When the [webhook listener](#configuration) is enabled, a health endpoint is
|
|
198
205
|
available at `GET /health`. It returns a JSON summary of all registered
|
|
199
206
|
integration statuses, useful for uptime monitoring (e.g. UptimeRobot).
|
|
@@ -164,6 +164,13 @@ See `config.example.toml` for the full keyword grammar and edge cases.
|
|
|
164
164
|
|
|
165
165
|
## Health monitoring
|
|
166
166
|
|
|
167
|
+
Credentials are validated once at startup. An integration whose key the service
|
|
168
|
+
rejects (HTTP 401/403) is marked unhealthy immediately and shows on `/health`,
|
|
169
|
+
rather than staying silent until its cron next fires — up to a day later for the
|
|
170
|
+
daily ones. Startup continues either way: one expired token does not take the
|
|
171
|
+
board down.
|
|
172
|
+
|
|
173
|
+
|
|
167
174
|
When the [webhook listener](#configuration) is enabled, a health endpoint is
|
|
168
175
|
available at `GET /health`. It returns a JSON summary of all registered
|
|
169
176
|
integration statuses, useful for uptime monitoring (e.g. UptimeRobot).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: e-note-ion
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: Automation for Vestaboard displays — with emotion
|
|
5
5
|
Author-email: Jason Puglisi <jason@pugli.si>
|
|
6
6
|
Maintainer-email: Jason Puglisi <jason@pugli.si>
|
|
@@ -194,6 +194,13 @@ See `config.example.toml` for the full keyword grammar and edge cases.
|
|
|
194
194
|
|
|
195
195
|
## Health monitoring
|
|
196
196
|
|
|
197
|
+
Credentials are validated once at startup. An integration whose key the service
|
|
198
|
+
rejects (HTTP 401/403) is marked unhealthy immediately and shows on `/health`,
|
|
199
|
+
rather than staying silent until its cron next fires — up to a day later for the
|
|
200
|
+
daily ones. Startup continues either way: one expired token does not take the
|
|
201
|
+
board down.
|
|
202
|
+
|
|
203
|
+
|
|
197
204
|
When the [webhook listener](#configuration) is enabled, a health endpoint is
|
|
198
205
|
available at `GET /health`. It returns a JSON summary of all registered
|
|
199
206
|
integration statuses, useful for uptime monitoring (e.g. UptimeRobot).
|
|
@@ -288,10 +288,19 @@ def _is_overdue(state: _TargetState, now: float) -> bool:
|
|
|
288
288
|
"""Return True if *state* has gone too long without firing. Caller holds _lock."""
|
|
289
289
|
if state.expected_interval is None:
|
|
290
290
|
return False
|
|
291
|
-
#
|
|
292
|
-
#
|
|
291
|
+
# An integration cannot be overdue for a window in which the scheduler was
|
|
292
|
+
# not running, so process start floors the reference. Without it, any outage
|
|
293
|
+
# longer than 2x an interval makes every short-cadence integration report
|
|
294
|
+
# overdue the moment we come back — /health returned 503 on startup after a
|
|
295
|
+
# 50-minute stop until uptimerobot (5 min cadence) next fired.
|
|
296
|
+
#
|
|
297
|
+
# registered_at cannot serve as that floor: _load_log() rebuilds targets from
|
|
298
|
+
# health.jsonl before register() runs, stamping them with the *event's*
|
|
299
|
+
# timestamp, and register() leaves an existing target alone. So a restored
|
|
300
|
+
# target carries an old registered_at too.
|
|
293
301
|
last = state.events[-1].timestamp if state.events else state.registered_at
|
|
294
|
-
|
|
302
|
+
reference = max(last, _started_at)
|
|
303
|
+
return (now - reference) > state.expected_interval * _OVERDUE_INTERVAL_MULTIPLIER
|
|
295
304
|
|
|
296
305
|
|
|
297
306
|
def record_success(name: str) -> None:
|
|
@@ -22,7 +22,7 @@ import requests
|
|
|
22
22
|
|
|
23
23
|
import integrations.vestaboard as _vb
|
|
24
24
|
from exceptions import IntegrationDataUnavailableError
|
|
25
|
-
from integrations.http import CacheEntry, fetch_with_retry, redact, user_agent
|
|
25
|
+
from integrations.http import CacheEntry, fetch_with_retry, raise_for_credentials, redact, user_agent
|
|
26
26
|
|
|
27
27
|
logger = logging.getLogger(__name__)
|
|
28
28
|
|
|
@@ -220,3 +220,18 @@ def get_variables() -> dict[str, list[list[str]]]:
|
|
|
220
220
|
logger.debug('BART: fetched departures for %s (dest filters: %s)', station, dest_filters)
|
|
221
221
|
_departures_cache = CacheEntry(variables)
|
|
222
222
|
return variables
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
def preflight() -> None:
|
|
226
|
+
"""Validate the BART API key at startup (#503)."""
|
|
227
|
+
import config as _config_mod
|
|
228
|
+
|
|
229
|
+
api_key = _config_mod.get('bart', 'api_key')
|
|
230
|
+
r = fetch_with_retry(
|
|
231
|
+
'GET',
|
|
232
|
+
f'{_API_BASE}/route.aspx',
|
|
233
|
+
params={'cmd': 'routes', 'key': api_key, 'json': 'y'},
|
|
234
|
+
headers={'User-Agent': user_agent()},
|
|
235
|
+
timeout=10,
|
|
236
|
+
)
|
|
237
|
+
raise_for_credentials(r, 'bart')
|
|
@@ -31,7 +31,7 @@ import requests
|
|
|
31
31
|
|
|
32
32
|
from exceptions import IntegrationDataUnavailableError
|
|
33
33
|
from integrations.color import fetch_cover_color
|
|
34
|
-
from integrations.http import CacheEntry, fetch_with_retry, user_agent
|
|
34
|
+
from integrations.http import CacheEntry, fetch_with_retry, raise_for_credentials, user_agent
|
|
35
35
|
|
|
36
36
|
logger = logging.getLogger(__name__)
|
|
37
37
|
|
|
@@ -212,3 +212,16 @@ def get_variables() -> dict[str, list[list[str]]]:
|
|
|
212
212
|
)
|
|
213
213
|
_collection_cache = CacheEntry(result)
|
|
214
214
|
return result
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
def preflight() -> None:
|
|
218
|
+
"""Validate the Discogs token at startup (#503).
|
|
219
|
+
|
|
220
|
+
GET /oauth/identity is the cheapest authenticated call the API offers, and
|
|
221
|
+
is the same endpoint _resolve_username uses.
|
|
222
|
+
"""
|
|
223
|
+
import config as _config_mod
|
|
224
|
+
|
|
225
|
+
token = _config_mod.get('discogs', 'api_key')
|
|
226
|
+
r = fetch_with_retry('GET', f'{_API_BASE}/oauth/identity', headers=_headers(token), timeout=10)
|
|
227
|
+
raise_for_credentials(r, 'discogs')
|
|
@@ -84,6 +84,28 @@ def user_agent() -> str:
|
|
|
84
84
|
return _ua_cache
|
|
85
85
|
|
|
86
86
|
|
|
87
|
+
class CredentialError(Exception):
|
|
88
|
+
"""Raised when a service rejects our credential (HTTP 401 or 403).
|
|
89
|
+
|
|
90
|
+
Deliberately narrow. Startup credential validation (#503) marks an
|
|
91
|
+
integration unhealthy on this and nothing else: a 500, a timeout or a DNS
|
|
92
|
+
blip at boot is not an expired token, and treating it as one would page
|
|
93
|
+
someone about a network hiccup. See raise_for_credentials.
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def raise_for_credentials(response: requests.Response, integration: str) -> None:
|
|
98
|
+
"""Raise CredentialError if *response* shows the credential was rejected.
|
|
99
|
+
|
|
100
|
+
One place classifies 401/403 so every integration agrees on what "bad
|
|
101
|
+
credential" means, rather than each inventing its own check.
|
|
102
|
+
"""
|
|
103
|
+
if response.status_code in (401, 403):
|
|
104
|
+
raise CredentialError(
|
|
105
|
+
f'{integration}: credential rejected by the service (HTTP {response.status_code}) — check the key in config.toml'
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
|
|
87
109
|
def fetch_with_retry(
|
|
88
110
|
method: str,
|
|
89
111
|
url: str,
|
|
@@ -15,7 +15,7 @@ from datetime import date, datetime
|
|
|
15
15
|
import requests
|
|
16
16
|
|
|
17
17
|
from exceptions import IntegrationDataUnavailableError
|
|
18
|
-
from integrations.http import CacheEntry, fetch_with_retry
|
|
18
|
+
from integrations.http import CacheEntry, fetch_with_retry, raise_for_credentials, user_agent
|
|
19
19
|
|
|
20
20
|
logger = logging.getLogger(__name__)
|
|
21
21
|
|
|
@@ -146,3 +146,12 @@ def get_variables() -> dict[str, list[list[str]]]:
|
|
|
146
146
|
_cache = CacheEntry(result)
|
|
147
147
|
logger.debug('Parcel: selected %r (%s)', description, carrier_code)
|
|
148
148
|
return result
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def preflight() -> None:
|
|
152
|
+
"""Validate the Parcel API key at startup (#503)."""
|
|
153
|
+
import config as _config_mod
|
|
154
|
+
|
|
155
|
+
api_key = _config_mod.get('parcel', 'api_key')
|
|
156
|
+
r = fetch_with_retry('GET', _API_URL, headers={'api-key': api_key, 'User-Agent': user_agent()}, timeout=10)
|
|
157
|
+
raise_for_credentials(r, 'parcel')
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
import functools
|
|
19
19
|
import logging
|
|
20
20
|
|
|
21
|
-
from integrations.http import fetch_with_retry, user_agent
|
|
21
|
+
from integrations.http import fetch_with_retry, raise_for_credentials, user_agent
|
|
22
22
|
|
|
23
23
|
logger = logging.getLogger(__name__)
|
|
24
24
|
|
|
@@ -351,3 +351,16 @@ def get_episode_group_position(show_id: int, tmdb_episode_id: int) -> tuple[int,
|
|
|
351
351
|
)
|
|
352
352
|
return (group_order, episode_number)
|
|
353
353
|
return None
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
def preflight() -> None:
|
|
357
|
+
"""Validate the TMDb read access token at startup (#503).
|
|
358
|
+
|
|
359
|
+
No-op when TMDb is not configured: it is optional, and an absent token is a
|
|
360
|
+
choice rather than a fault.
|
|
361
|
+
"""
|
|
362
|
+
if not is_configured():
|
|
363
|
+
return
|
|
364
|
+
|
|
365
|
+
r = fetch_with_retry('GET', f'{_TMDB_API_BASE}/configuration', headers=_request_headers(), timeout=10)
|
|
366
|
+
raise_for_credentials(r, 'tmdb')
|
|
@@ -22,7 +22,7 @@ import requests
|
|
|
22
22
|
|
|
23
23
|
import integrations.vestaboard as _vb
|
|
24
24
|
from exceptions import IntegrationDataUnavailableError
|
|
25
|
-
from integrations.http import CacheEntry, fetch_with_retry
|
|
25
|
+
from integrations.http import CacheEntry, fetch_with_retry, raise_for_credentials
|
|
26
26
|
|
|
27
27
|
logger = logging.getLogger(__name__)
|
|
28
28
|
|
|
@@ -174,3 +174,17 @@ def get_variables() -> dict[str, list[list[str]]]:
|
|
|
174
174
|
|
|
175
175
|
_cache = CacheEntry(result)
|
|
176
176
|
return result
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def preflight() -> None:
|
|
180
|
+
"""Validate the UptimeRobot API key at startup (#503).
|
|
181
|
+
|
|
182
|
+
UptimeRobot answers a bad key with HTTP 401, so this does not need to inspect
|
|
183
|
+
the body — unlike get_variables, which must distinguish "all monitors up"
|
|
184
|
+
(an expected-empty result) from a real failure.
|
|
185
|
+
"""
|
|
186
|
+
import config as _config_mod
|
|
187
|
+
|
|
188
|
+
api_key = _config_mod.get('uptimerobot', 'api_key')
|
|
189
|
+
r = fetch_with_retry('POST', _API_URL, data={'api_key': api_key, 'format': 'json', 'limit': 1}, timeout=10)
|
|
190
|
+
raise_for_credentials(r, 'uptimerobot')
|
|
@@ -19,7 +19,7 @@ from datetime import date
|
|
|
19
19
|
import requests
|
|
20
20
|
|
|
21
21
|
from exceptions import IntegrationDataUnavailableError
|
|
22
|
-
from integrations.http import CacheEntry, fetch_with_retry, user_agent
|
|
22
|
+
from integrations.http import CacheEntry, fetch_with_retry, raise_for_credentials, user_agent
|
|
23
23
|
|
|
24
24
|
logger = logging.getLogger(__name__)
|
|
25
25
|
|
|
@@ -246,3 +246,12 @@ def get_variables() -> dict[str, list[list[str]]]:
|
|
|
246
246
|
_cache = CacheEntry(result)
|
|
247
247
|
logger.debug('YNAB: net_worth=%s, delta=%s', amount_line, pct_line)
|
|
248
248
|
return result
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
def preflight() -> None:
|
|
252
|
+
"""Validate the YNAB personal access token at startup (#503)."""
|
|
253
|
+
import config as _config_mod
|
|
254
|
+
|
|
255
|
+
api_key = _config_mod.get('ynab', 'api_key')
|
|
256
|
+
r = fetch_with_retry('GET', f'{_BASE_URL}/budgets', headers=_headers(api_key), timeout=10)
|
|
257
|
+
raise_for_credentials(r, 'ynab')
|
|
@@ -1845,8 +1845,19 @@ def main() -> None:
|
|
|
1845
1845
|
mod = _get_integration(name)
|
|
1846
1846
|
if hasattr(mod, 'preflight'):
|
|
1847
1847
|
mod.preflight()
|
|
1848
|
+
except _http.CredentialError as e:
|
|
1849
|
+
# The credential is bad, which is worth surfacing now rather than
|
|
1850
|
+
# whenever this integration's cron next fires — up to a day later for the
|
|
1851
|
+
# daily ones. Recorded as an error so /health reports it and #504
|
|
1852
|
+
# alerting picks it up. Startup deliberately continues: one expired token
|
|
1853
|
+
# should not take the board down. (#503)
|
|
1854
|
+
logger.error('%s', _http.redact(str(e)))
|
|
1855
|
+
_health_mod.record_error(name, _http.redact(str(e)))
|
|
1848
1856
|
except Exception as e: # noqa: BLE001
|
|
1849
|
-
|
|
1857
|
+
# Anything else — a 500, a timeout, DNS at boot — is not an expired
|
|
1858
|
+
# token. Logged, but not recorded, so /health keeps meaning "your
|
|
1859
|
+
# credential is bad" rather than "something was briefly flaky".
|
|
1860
|
+
logger.warning('preflight for %r failed: %s', name, _http.redact(str(e)))
|
|
1850
1861
|
|
|
1851
1862
|
threading.Thread(target=worker, daemon=True).start()
|
|
1852
1863
|
_health_mod.start_periodic_log()
|
|
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
|