s365b.notify.delivery¶
Delivering recorded events by email.
Attributes¶
Functions¶
|
Create the notifier for a method. |
|
Send through the primary method, then the fallback. |
|
Deliver events that are due. |
|
Send a test email with one method (no fallback). |
Module Contents¶
- async s365b.notify.delivery.build_notifier(services: s365b.core.services.Services, s: sqlalchemy.ext.asyncio.AsyncSession, method: str, cfg: s365b.notify.settings.NotificationSettings, stack: contextlib.AsyncExitStack) s365b.notify.senders.Notifier[source]¶
Create the notifier for a method.
- Parameters:
services – Process services (tests replace
notifier_factory).s – Open session.
method –
graphorsmtp.cfg – Notification settings.
stack – Closes the Graph client when delivery is done.
- Returns:
The notifier.
- Raises:
SendError – If the method is not set up.
- async s365b.notify.delivery.send_with_fallback(services: s365b.core.services.Services, s: sqlalchemy.ext.asyncio.AsyncSession, cfg: s365b.notify.settings.NotificationSettings, message: s365b.notify.message.Message, stack: contextlib.AsyncExitStack) str | None[source]¶
Send through the primary method, then the fallback.
- Parameters:
services – Process services.
s – Open session.
cfg – Notification settings.
message – The message.
stack – Owns Graph clients.
- Returns:
A note if the primary failed but the fallback worked, else
None.- Raises:
SendError – If every method failed (message lists each error).
- async s365b.notify.delivery.deliver_pending(services: s365b.core.services.Services, *, now: datetime.datetime | None = None, limit: int = 50) dict[str, int][source]¶
Deliver events that are due.
Each event is sent, skipped (email off, or below the minimum severity), throttled (the same alert was sent recently), or retried later; after the last retry it is marked failed. Its state is visible in the UI.
- Parameters:
services – Process services.
now – Current time (tests).
limit – Most events handled per call.
- Returns:
Count of events per outcome.
- async s365b.notify.delivery.send_test(services: s365b.core.services.Services, cfg: s365b.notify.settings.NotificationSettings, method: str) None[source]¶
Send a test email with one method (no fallback).
- Parameters:
services – Process services.
cfg – Settings to test (may be unsaved edits).
method –
graphorsmtp.
- Raises:
SendError – With the reason it failed.