init
This commit is contained in:
commit
f7787359c3
|
|
@ -0,0 +1,14 @@
|
||||||
|
*.egg-info
|
||||||
|
*.pot
|
||||||
|
*.py[co]
|
||||||
|
*.bat
|
||||||
|
*.pyproj
|
||||||
|
*.sln
|
||||||
|
__pycache__
|
||||||
|
.DS_Store
|
||||||
|
.idea/*
|
||||||
|
.venv/*
|
||||||
|
.tmp/*
|
||||||
|
.env
|
||||||
|
db.sqlite3
|
||||||
|
media/
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
3.10
|
||||||
|
|
@ -0,0 +1,130 @@
|
||||||
|
# notify
|
||||||
|
|
||||||
|
Django-приложение для уведомлений пользователя: запись в базу, доставка по каналам и API непрочитанных сообщений в браузере.
|
||||||
|
|
||||||
|
## Подключение
|
||||||
|
|
||||||
|
```python
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
...
|
||||||
|
"notify",
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
Приложение использует `AUTH_USER_MODEL` проекта. После подключения:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python manage.py migrate
|
||||||
|
```
|
||||||
|
|
||||||
|
Создание уведомления из кода хоста:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from django.core.files.base import ContentFile
|
||||||
|
|
||||||
|
from notify.services import create_notification
|
||||||
|
|
||||||
|
create_notification(
|
||||||
|
verb="Заявка одобрена",
|
||||||
|
attachments=[ContentFile(b"...", name="report.pdf")],
|
||||||
|
recipients=[
|
||||||
|
{
|
||||||
|
"user": user,
|
||||||
|
"channels": [
|
||||||
|
{"channel": "browser"},
|
||||||
|
{"channel": "email", "target": {"email": user.email}},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
`create_notification` выбрасывает `ValueError`, если тип выключен, канал не входит в тип, канал неизвестен или получатель продублирован. Неактивный тип и пропущенный канал не оставляют пустое уведомление в базе.
|
||||||
|
|
||||||
|
Получатель канала задаётся словарём `target`, который проверяется pydantic-схемой провайдера: `email` — `{"email": ...}`, `telegram` — `{"chat_id": ...}`, `max` — `{"chat_id": ..., "user_id": ...}` (`user_id` необязателен). У `browser` `target` нет. В базе он хранится в `NotificationRecipient.delivery_target`. Если у типа `can_switch=True`, канал с `NotificationChannelPreference.enabled=False` не создаётся. Строки предпочтения нет — канал остаётся включённым. `can_switch=False` не смотрит на предпочтения. Если после фильтра не осталось получателей, уведомление откатывается.
|
||||||
|
|
||||||
|
Повтор с тем же `idempotency_key` возвращает уже созданную строку и не добавляет новые файлы. `group=True` при непустом `object_id` увеличивает `data["count"]` у непрочитанного browser-уведомления того же типа и объекта и не создаёт новую строку. Файлы такого вызова копируются и на схлопнутое уведомление, и на новое, если часть получателей не схлопнулась.
|
||||||
|
|
||||||
|
`attachments` — список Django-файлов (`UploadedFile`, `File`, `ContentFile` с именем). Пустое имя, больше 10 файлов или файл больше 10 МБ дают `ValueError`, уведомление не сохраняется. Лимиты переопределяются настройками `NOTIFY_MAX_ATTACHMENTS` и `NOTIFY_MAX_ATTACHMENT_BYTES`. Файлы лежат в default storage по пути `notify/attachments/` и не раздаются через `MEDIA_URL`. Удаление уведомления удаляет файлы из хранилища. В письмо они попадают вложением. Telegram и MAX остаются текстом.
|
||||||
|
|
||||||
|
## Доставка
|
||||||
|
|
||||||
|
Каналы `email`, `max` и `telegram` ставятся в Celery-задачу `notify.tasks.deliver_notification` после коммита транзакции. Канал `browser` помечается отправленным сразу и попадает в API.
|
||||||
|
|
||||||
|
Воркер берёт строку получателя с блокировкой. Ошибка SMTP или временная ошибка HTTP повторяется до 5 раз с паузами 1, 2, 4, 8 и 16 минут (плюс до 10% случайной добавки). Таймаут SMTP и HTTP — 10 секунд. Каждая попытка увеличивает `attempts` и пишет `last_error`. Постоянная ошибка и исчерпание попыток ставят статус `FAILED`. Успех ставит `SENT` и `sent_at`.
|
||||||
|
|
||||||
|
Нужен брокер Celery и автообнаружение задач установленного приложения `notify`. Расписание удаления просроченных уведомлений (раз в час):
|
||||||
|
|
||||||
|
```python
|
||||||
|
from notify.tasks import BEAT_SCHEDULE
|
||||||
|
|
||||||
|
app.conf.beat_schedule.update(BEAT_SCHEDULE)
|
||||||
|
```
|
||||||
|
|
||||||
|
Туда же входит удаление просроченных кодов подтверждения (раз в час, в :30). Без этой записи строки с истёкшим `expires_at` не удаляются. API их всё равно не показывает.
|
||||||
|
|
||||||
|
Почтовый конфиг по умолчанию: порт `587`, `use_tls=True`, `use_ssl=False`. Одновременно включить SSL и TLS нельзя. Для каждого канала хранится один конфиг и один шаблон с `is_default=True` и пустым типом. Шаблон с указанным типом используется только для этой пары тип+канал, иначе берётся дефолт канала.
|
||||||
|
|
||||||
|
Пароль SMTP и токены MAX и Telegram лежат в базе открытым текстом. В форме админки значение не подставляется обратно в HTML; пустое поле при сохранении оставляет прежний секрет. Проверка SMTP в админке — только POST.
|
||||||
|
|
||||||
|
## Коды подтверждения
|
||||||
|
|
||||||
|
Одноразовые коды отправляются в `email`, `telegram` и `max` синхронно, без Celery и без создания `Notification`:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from notify.codes import CodeThrottled, send_code, verify_code
|
||||||
|
|
||||||
|
try:
|
||||||
|
send_code(purpose="login", channel="email", target={"email": user.email}, user=user)
|
||||||
|
except CodeThrottled as exc:
|
||||||
|
... # exc.retry_after — сколько секунд ждать
|
||||||
|
|
||||||
|
send_code(purpose="login", channel="telegram", target={"chat_id": 42})
|
||||||
|
|
||||||
|
verify_code(purpose="login", channel="email", target={"email": user.email}, code="123456") # True / False
|
||||||
|
```
|
||||||
|
|
||||||
|
`target` проверяется так же, как в `create_notification`. Неизвестный канал, `browser` или некорректный получатель дают `ValueError`. Ошибка провайдера пробрасывается как `DeliveryError` или `PermanentDeliveryError`. В этом случае новый код не сохраняется, а предыдущий остаётся действующим.
|
||||||
|
|
||||||
|
Код ищется по ключу `purpose` + канал + получатель. Email сравнивается без учёта регистра, для MAX ключом служит `user_id`, если он передан, иначе `chat_id`. Новый код гасит предыдущий. Повторная отправка раньше `NOTIFY_CODE_RESEND_INTERVAL` даёт `CodeThrottled`. `verify_code` возвращает `False`, если кода нет, он истёк, уже использован или попытки исчерпаны. Каждая проверка увеличивает `attempts`, успешная помечает код использованным.
|
||||||
|
|
||||||
|
В базе лежит только HMAC от `SECRET_KEY` и id строки. Смена `SECRET_KEY` делает выданные коды недействительными. Сам код не пишется в базу, логи и тексты исключений.
|
||||||
|
|
||||||
|
Текст по умолчанию: «Код подтверждения: 123456. Действует 5 мин.». Чтобы задать свой, передайте `type=` (код или объект `NotificationType`) и создайте `NotificationTemplate` с этим типом и каналом. Контекст шаблона: `code`, `ttl_minutes`, `purpose`, `user.id`, `user.username` (`user` равен `None`, если пользователь не передан). Шаблон канала по умолчанию для кодов не используется.
|
||||||
|
|
||||||
|
Настройки:
|
||||||
|
|
||||||
|
```python
|
||||||
|
NOTIFY_CODE_LENGTH = 6 # цифр
|
||||||
|
NOTIFY_CODE_TTL = 300 # секунд
|
||||||
|
NOTIFY_CODE_MAX_ATTEMPTS = 5
|
||||||
|
NOTIFY_CODE_RESEND_INTERVAL = 60 # секунд, 0 — без ограничения
|
||||||
|
```
|
||||||
|
|
||||||
|
Просроченные коды удаляет задача `notify.tasks.delete_expired_codes`, она входит в `BEAT_SCHEDULE`.
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
Маршруты читают browser-уведомления текущего пользователя (сессионная авторизация django-ninja):
|
||||||
|
|
||||||
|
- `GET unread-count/`
|
||||||
|
- `GET count/`
|
||||||
|
- `GET list/`
|
||||||
|
- `GET attachments/{id}/`
|
||||||
|
- `POST make-read/{id}/`
|
||||||
|
- `POST make-unread/{id}/`
|
||||||
|
- `POST make-all-read/`
|
||||||
|
|
||||||
|
Просроченные уведомления в эти выборки не входят. Некорректный id возвращает 404.
|
||||||
|
|
||||||
|
`GET list/` отдаёт `attachments`: `id`, `name`, `size`, `content_type`, `url`. `GET attachments/{id}/` скачивает файл, если у текущего пользователя есть получатель этого уведомления и срок не истёк. Чужой и просроченный файл возвращают 404.
|
||||||
|
|
||||||
|
API не кэширует ответы и не требует кэша или Redis.
|
||||||
|
|
||||||
|
Шаблоны subject и body пишутся на Jinja2 и экранируют HTML. Фильтр `markdown` рендерит текст в HTML, предварительно экранируя сырой HTML: `{{ notification.description | markdown }}`. Пропущенное поле остаётся пустой строкой. Контекст — обычные словари, не модели: `notification.verb`, `notification.description`, `notification.url`, `notification.level`, `notification.data`, `notification.object_id`, `recipient.delivery_target` (например, `recipient.delivery_target.email`), `recipient.delivery_channel`, `user.username`.
|
||||||
|
|
||||||
|
## Тесты
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DJANGO_SETTINGS_MODULE=tests.settings python -m django test tests
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
from .celery import app as celery_app
|
||||||
|
|
||||||
|
__all__ = ('celery_app',)
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class DemoConfig(AppConfig):
|
||||||
|
name = 'demo'
|
||||||
|
|
||||||
|
def ready(self):
|
||||||
|
from demo.celery import app
|
||||||
|
from notify.tasks import BEAT_SCHEDULE
|
||||||
|
|
||||||
|
app.conf.beat_schedule.update(BEAT_SCHEDULE)
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
"""
|
||||||
|
ASGI config for demo project.
|
||||||
|
|
||||||
|
It exposes the ASGI callable as a module-level variable named ``application``.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.0/howto/deployment/asgi/
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
from django.core.asgi import get_asgi_application
|
||||||
|
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'demo.settings')
|
||||||
|
|
||||||
|
application = get_asgi_application()
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
import os
|
||||||
|
|
||||||
|
from celery import Celery
|
||||||
|
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'demo.settings')
|
||||||
|
|
||||||
|
app = Celery('demo')
|
||||||
|
app.config_from_object('django.conf:settings', namespace='CELERY')
|
||||||
|
app.autodiscover_tasks()
|
||||||
|
|
@ -0,0 +1,132 @@
|
||||||
|
"""
|
||||||
|
Django settings for demo project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.0.6.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.0/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.0/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
|
|
||||||
|
|
||||||
|
# Quick-start development settings - unsuitable for production
|
||||||
|
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = 'django-insecure-xsl5fk9rcbk_n6rv7-!i27+h!z(d&8*6ab6!%4kyijiohxvn(e'
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = True
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = []
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'notify',
|
||||||
|
'demo.apps.DemoConfig',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'demo.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.debug',
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'demo.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
'NAME': BASE_DIR / 'db.sqlite3',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
LOGIN_URL = '/admin/login/'
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.0/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.0/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
MEDIA_ROOT = BASE_DIR / 'media'
|
||||||
|
MEDIA_URL = '/media/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
|
|
||||||
|
CELERY_BROKER_URL = 'redis://127.0.0.1:6379/0'
|
||||||
|
CELERY_TASK_IGNORE_RESULT = True
|
||||||
|
|
@ -0,0 +1,187 @@
|
||||||
|
(function () {
|
||||||
|
const listEl = document.getElementById("list");
|
||||||
|
const countEl = document.getElementById("unread-count");
|
||||||
|
const statusEl = document.getElementById("status");
|
||||||
|
const form = document.getElementById("create-form");
|
||||||
|
const formError = document.getElementById("form-error");
|
||||||
|
const unreadOnly = document.getElementById("unread-only");
|
||||||
|
const markAll = document.getElementById("mark-all");
|
||||||
|
|
||||||
|
let refreshing = false;
|
||||||
|
|
||||||
|
function csrfToken() {
|
||||||
|
const match = document.cookie.match(/(?:^|; )csrftoken=([^;]*)/);
|
||||||
|
return match ? decodeURIComponent(match[1]) : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function showStatus(message) {
|
||||||
|
statusEl.hidden = !message;
|
||||||
|
statusEl.textContent = message || "";
|
||||||
|
}
|
||||||
|
|
||||||
|
async function api(path, options) {
|
||||||
|
const response = await fetch(path, {
|
||||||
|
credentials: "same-origin",
|
||||||
|
...options,
|
||||||
|
headers: {
|
||||||
|
"X-CSRFToken": csrfToken(),
|
||||||
|
...(options && options.headers),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(response.status + " " + path);
|
||||||
|
}
|
||||||
|
if (response.status === 204) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const text = await response.text();
|
||||||
|
return text ? JSON.parse(text) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderItem(item) {
|
||||||
|
const card = document.createElement("article");
|
||||||
|
card.className = "item " + (item.level || "INFO") + (item.unread ? " unread" : "");
|
||||||
|
|
||||||
|
const verb = document.createElement("div");
|
||||||
|
verb.className = "verb";
|
||||||
|
verb.textContent = item.verb || "";
|
||||||
|
card.appendChild(verb);
|
||||||
|
|
||||||
|
if (item.description) {
|
||||||
|
const description = document.createElement("div");
|
||||||
|
description.textContent = item.description;
|
||||||
|
card.appendChild(description);
|
||||||
|
}
|
||||||
|
|
||||||
|
const meta = document.createElement("div");
|
||||||
|
meta.className = "meta";
|
||||||
|
const level = document.createElement("span");
|
||||||
|
level.textContent = item.level || "";
|
||||||
|
const time = document.createElement("time");
|
||||||
|
const created = item.created_at ? new Date(item.created_at) : null;
|
||||||
|
time.dateTime = item.created_at || "";
|
||||||
|
time.textContent = created && !Number.isNaN(created.getTime())
|
||||||
|
? created.toLocaleString()
|
||||||
|
: "";
|
||||||
|
meta.append(level, time);
|
||||||
|
if (item.url) {
|
||||||
|
const link = document.createElement("a");
|
||||||
|
link.href = item.url;
|
||||||
|
link.textContent = item.url;
|
||||||
|
link.target = "_blank";
|
||||||
|
link.rel = "noreferrer";
|
||||||
|
meta.appendChild(link);
|
||||||
|
}
|
||||||
|
card.appendChild(meta);
|
||||||
|
|
||||||
|
if (item.attachments && item.attachments.length) {
|
||||||
|
const files = document.createElement("div");
|
||||||
|
files.className = "files";
|
||||||
|
item.attachments.forEach(function (file) {
|
||||||
|
const link = document.createElement("a");
|
||||||
|
link.href = file.url;
|
||||||
|
link.textContent = file.name;
|
||||||
|
files.appendChild(link);
|
||||||
|
});
|
||||||
|
card.appendChild(files);
|
||||||
|
}
|
||||||
|
|
||||||
|
const action = document.createElement("button");
|
||||||
|
action.type = "button";
|
||||||
|
action.className = "ghost";
|
||||||
|
action.textContent = item.unread ? "Прочитать" : "Вернуть в непрочитанные";
|
||||||
|
action.addEventListener("click", function () {
|
||||||
|
const path = item.unread
|
||||||
|
? "/api/make-read/" + item.id + "/"
|
||||||
|
: "/api/make-unread/" + item.id + "/";
|
||||||
|
api(path, { method: "POST" }).then(refresh).catch(function (error) {
|
||||||
|
showStatus(error.message);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
card.appendChild(action);
|
||||||
|
|
||||||
|
if (item.unread) {
|
||||||
|
card.addEventListener("click", function (event) {
|
||||||
|
if (event.target.closest("a, button")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
api("/api/make-read/" + item.id + "/", { method: "POST" })
|
||||||
|
.then(refresh)
|
||||||
|
.catch(function (error) {
|
||||||
|
showStatus(error.message);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return card;
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderList(items) {
|
||||||
|
listEl.replaceChildren();
|
||||||
|
if (!items.length) {
|
||||||
|
const empty = document.createElement("p");
|
||||||
|
empty.className = "empty";
|
||||||
|
empty.textContent = "Нет уведомлений";
|
||||||
|
listEl.appendChild(empty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
items.forEach(function (item) {
|
||||||
|
listEl.appendChild(renderItem(item));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function refresh() {
|
||||||
|
if (refreshing) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
refreshing = true;
|
||||||
|
const listPath = unreadOnly.checked ? "/api/list/?unread=true" : "/api/list/";
|
||||||
|
return Promise.all([
|
||||||
|
api("/api/unread-count/"),
|
||||||
|
api(listPath),
|
||||||
|
]).then(function (payload) {
|
||||||
|
countEl.textContent = String(payload[0].result);
|
||||||
|
renderList(payload[1].results || []);
|
||||||
|
showStatus("");
|
||||||
|
}).catch(function (error) {
|
||||||
|
showStatus(error.message);
|
||||||
|
}).finally(function () {
|
||||||
|
refreshing = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
form.addEventListener("submit", function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
formError.hidden = true;
|
||||||
|
formError.textContent = "";
|
||||||
|
fetch("/create/", {
|
||||||
|
method: "POST",
|
||||||
|
credentials: "same-origin",
|
||||||
|
headers: { "X-CSRFToken": csrfToken() },
|
||||||
|
body: new FormData(form),
|
||||||
|
}).then(function (response) {
|
||||||
|
return response.json().then(function (data) {
|
||||||
|
if (!response.ok) {
|
||||||
|
formError.hidden = false;
|
||||||
|
formError.textContent = (data && data.error) || "Не удалось создать уведомление";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
form.reset();
|
||||||
|
return refresh();
|
||||||
|
});
|
||||||
|
}).catch(function () {
|
||||||
|
formError.hidden = false;
|
||||||
|
formError.textContent = "Не удалось создать уведомление";
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
unreadOnly.addEventListener("change", refresh);
|
||||||
|
markAll.addEventListener("click", function () {
|
||||||
|
api("/api/make-all-read/", { method: "POST" }).then(refresh).catch(function (error) {
|
||||||
|
showStatus(error.message);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
refresh();
|
||||||
|
setInterval(refresh, 3000);
|
||||||
|
})();
|
||||||
|
|
@ -0,0 +1,201 @@
|
||||||
|
{% load static %}
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="ru">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>Уведомления</title>
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
color-scheme: light;
|
||||||
|
--bg: #f4f5f7;
|
||||||
|
--card: #fff;
|
||||||
|
--text: #1c1e21;
|
||||||
|
--muted: #5c6370;
|
||||||
|
--line: #e2e5ea;
|
||||||
|
--info: #2f6fed;
|
||||||
|
--success: #1f8a4c;
|
||||||
|
--warning: #b86e00;
|
||||||
|
--error: #c4362c;
|
||||||
|
}
|
||||||
|
* { box-sizing: border-box; }
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
font: 15px/1.45 system-ui, sans-serif;
|
||||||
|
color: var(--text);
|
||||||
|
background: var(--bg);
|
||||||
|
}
|
||||||
|
main {
|
||||||
|
max-width: 880px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 32px 20px 48px;
|
||||||
|
display: grid;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 22px;
|
||||||
|
font-weight: 650;
|
||||||
|
}
|
||||||
|
.panel {
|
||||||
|
background: var(--card);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
form {
|
||||||
|
display: grid;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
label {
|
||||||
|
display: grid;
|
||||||
|
gap: 4px;
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--muted);
|
||||||
|
}
|
||||||
|
input, select, textarea, button {
|
||||||
|
font: inherit;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
input, select, textarea {
|
||||||
|
width: 100%;
|
||||||
|
padding: 8px 10px;
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: 8px;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
textarea { min-height: 72px; resize: vertical; }
|
||||||
|
.row {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 160px 1fr;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
button, .linkish {
|
||||||
|
border: 0;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 8px 12px;
|
||||||
|
background: var(--info);
|
||||||
|
color: #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
button.ghost, .linkish {
|
||||||
|
background: transparent;
|
||||||
|
color: var(--info);
|
||||||
|
padding: 4px 0;
|
||||||
|
}
|
||||||
|
.toolbar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
.count {
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
.filter {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
color: var(--text);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
.list { display: grid; gap: 8px; }
|
||||||
|
.item {
|
||||||
|
display: grid;
|
||||||
|
gap: 4px;
|
||||||
|
padding: 12px 12px 12px 14px;
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-left: 4px solid var(--info);
|
||||||
|
border-radius: 10px;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
.item.unread { background: #f7f9ff; }
|
||||||
|
.item.SUCCESS { border-left-color: var(--success); }
|
||||||
|
.item.WARNING { border-left-color: var(--warning); }
|
||||||
|
.item.ERROR { border-left-color: var(--error); }
|
||||||
|
.item button { justify-self: start; }
|
||||||
|
.meta {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
.verb { font-weight: 650; }
|
||||||
|
.files {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px 12px;
|
||||||
|
}
|
||||||
|
.files a { color: var(--info); }
|
||||||
|
.error {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--error);
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
.empty, .status {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--muted);
|
||||||
|
}
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.row { grid-template-columns: 1fr; }
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<main>
|
||||||
|
<h1>Уведомления</h1>
|
||||||
|
|
||||||
|
<section class="panel">
|
||||||
|
<form id="create-form">
|
||||||
|
{% csrf_token %}
|
||||||
|
<label>
|
||||||
|
Текст
|
||||||
|
<input name="verb" required maxlength="255" autocomplete="off">
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Описание
|
||||||
|
<textarea name="description"></textarea>
|
||||||
|
</label>
|
||||||
|
<div class="row">
|
||||||
|
<label>
|
||||||
|
Уровень
|
||||||
|
<select name="level">
|
||||||
|
<option value="INFO">INFO</option>
|
||||||
|
<option value="SUCCESS">SUCCESS</option>
|
||||||
|
<option value="WARNING">WARNING</option>
|
||||||
|
<option value="ERROR">ERROR</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Ссылка
|
||||||
|
<input name="url" type="url" placeholder="https://">
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<label>
|
||||||
|
Файлы
|
||||||
|
<input name="attachments" type="file" multiple>
|
||||||
|
</label>
|
||||||
|
<p class="error" id="form-error" hidden></p>
|
||||||
|
<div>
|
||||||
|
<button type="submit">Создать</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="panel">
|
||||||
|
<div class="toolbar">
|
||||||
|
<strong class="count">Непрочитанные: <span id="unread-count">0</span></strong>
|
||||||
|
<label class="filter">
|
||||||
|
<input id="unread-only" type="checkbox">
|
||||||
|
Только непрочитанные
|
||||||
|
</label>
|
||||||
|
<button type="button" id="mark-all" class="ghost">Прочитать все</button>
|
||||||
|
</div>
|
||||||
|
<p class="status" id="status" hidden></p>
|
||||||
|
<div class="list" id="list"></div>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
<script src="{% static 'demo/inbox.js' %}"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
"""
|
||||||
|
URL configuration for demo project.
|
||||||
|
|
||||||
|
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||||
|
https://docs.djangoproject.com/en/5.0/topics/http/urls/
|
||||||
|
Examples:
|
||||||
|
Function views
|
||||||
|
1. Add an import: from my_app import views
|
||||||
|
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||||
|
Class-based views
|
||||||
|
1. Add an import: from other_app.views import Home
|
||||||
|
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||||
|
Including another URLconf
|
||||||
|
1. Import the include() function: from django.urls import include, path
|
||||||
|
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||||
|
"""
|
||||||
|
from django.contrib import admin
|
||||||
|
from django.urls import include, path
|
||||||
|
|
||||||
|
from demo.views import create_notification_view, inbox
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('admin/', admin.site.urls),
|
||||||
|
path('api/', include('notify.urls')),
|
||||||
|
path('create/', create_notification_view, name='create-notification'),
|
||||||
|
path('', inbox, name='inbox'),
|
||||||
|
]
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
|
from django.http import JsonResponse
|
||||||
|
from django.shortcuts import render
|
||||||
|
from django.views.decorators.http import require_GET, require_POST
|
||||||
|
|
||||||
|
from notify.models import DeliveryChannel, NotificationLevel
|
||||||
|
from notify.services import create_notification
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
@require_GET
|
||||||
|
def inbox(request):
|
||||||
|
return render(request, "demo/inbox.html")
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
@require_POST
|
||||||
|
def create_notification_view(request):
|
||||||
|
verb = (request.POST.get("verb") or "").strip()
|
||||||
|
description = (request.POST.get("description") or "").strip() or None
|
||||||
|
level = (request.POST.get("level") or NotificationLevel.INFO).strip()
|
||||||
|
url = (request.POST.get("url") or "").strip() or None
|
||||||
|
|
||||||
|
if level not in NotificationLevel.values:
|
||||||
|
return JsonResponse({"ok": False, "error": "Unknown level"}, status=400)
|
||||||
|
|
||||||
|
attachments = [
|
||||||
|
uploaded
|
||||||
|
for uploaded in request.FILES.getlist("attachments")
|
||||||
|
if getattr(uploaded, "name", "")
|
||||||
|
]
|
||||||
|
try:
|
||||||
|
create_notification(
|
||||||
|
verb=verb,
|
||||||
|
description=description,
|
||||||
|
level=level,
|
||||||
|
url=url,
|
||||||
|
attachments=attachments,
|
||||||
|
recipients=[
|
||||||
|
{
|
||||||
|
"user": request.user,
|
||||||
|
"channels": [{"channel": DeliveryChannel.BROWSER}],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
except ValueError as exc:
|
||||||
|
return JsonResponse({"ok": False, "error": str(exc)}, status=400)
|
||||||
|
|
||||||
|
return JsonResponse({"ok": True})
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
"""
|
||||||
|
WSGI config for demo project.
|
||||||
|
|
||||||
|
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.0/howto/deployment/wsgi/
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'demo.settings')
|
||||||
|
|
||||||
|
application = get_wsgi_application()
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
"""Django's command-line utility for administrative tasks."""
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Run administrative tasks."""
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'demo.settings')
|
||||||
|
try:
|
||||||
|
from django.core.management import execute_from_command_line
|
||||||
|
except ImportError as exc:
|
||||||
|
raise ImportError(
|
||||||
|
"Couldn't import Django. Are you sure it's installed and "
|
||||||
|
"available on your PYTHONPATH environment variable? Did you "
|
||||||
|
"forget to activate a virtual environment?"
|
||||||
|
) from exc
|
||||||
|
execute_from_command_line(sys.argv)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
|
@ -0,0 +1,282 @@
|
||||||
|
|
||||||
|
from django import forms
|
||||||
|
from django.contrib import admin
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from django.urls import reverse, path
|
||||||
|
from notify.admin_views import (
|
||||||
|
delivery_email_test_connection,
|
||||||
|
delivery_email_send_test_message,
|
||||||
|
)
|
||||||
|
from ace_editor.widgets import AceEditorWidget
|
||||||
|
|
||||||
|
from .models import (
|
||||||
|
DeliveryChannel,
|
||||||
|
DeliveryEmailConfig,
|
||||||
|
DeliveryTokenConfig,
|
||||||
|
NotificationAttachment,
|
||||||
|
NotificationChannelPreference,
|
||||||
|
NotificationGroup,
|
||||||
|
NotificationTemplate,
|
||||||
|
NotificationType,
|
||||||
|
Notification,
|
||||||
|
NotificationRecipient,
|
||||||
|
VerificationCode,
|
||||||
|
)
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"DeliveryEmailConfigForm",
|
||||||
|
"DeliveryTokenConfigForm",
|
||||||
|
"DeliveryEmailConfigAdmin",
|
||||||
|
"DeliveryTokenConfigAdmin",
|
||||||
|
"NotificationTemplateAdmin",
|
||||||
|
"NotificationGroupAdmin",
|
||||||
|
"NotificationTypeAdmin",
|
||||||
|
"NotificationAttachmentInline",
|
||||||
|
"NotificationRecipientInline",
|
||||||
|
"NotificationAdmin",
|
||||||
|
"NotificationRecipientAdmin",
|
||||||
|
"VerificationCodeAdmin",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class DeliveryEmailConfigForm(forms.ModelForm):
|
||||||
|
class Meta:
|
||||||
|
model = DeliveryEmailConfig
|
||||||
|
fields = "__all__"
|
||||||
|
widgets = {
|
||||||
|
"password": forms.PasswordInput(render_value=False),
|
||||||
|
}
|
||||||
|
|
||||||
|
def clean_password(self):
|
||||||
|
password = self.cleaned_data.get("password")
|
||||||
|
if not password and self.instance.pk:
|
||||||
|
return self.instance.password
|
||||||
|
return password
|
||||||
|
|
||||||
|
|
||||||
|
class DeliveryTokenConfigForm(forms.ModelForm):
|
||||||
|
class Meta:
|
||||||
|
model = DeliveryTokenConfig
|
||||||
|
fields = "__all__"
|
||||||
|
widgets = {
|
||||||
|
"token": forms.PasswordInput(render_value=False),
|
||||||
|
}
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
allowed = {DeliveryChannel.MAX, DeliveryChannel.TELEGRAM}
|
||||||
|
self.fields["channel"].choices = [
|
||||||
|
choice for choice in DeliveryChannel.choices if choice[0] in allowed
|
||||||
|
]
|
||||||
|
|
||||||
|
def clean_token(self):
|
||||||
|
token = self.cleaned_data.get("token")
|
||||||
|
if not token and self.instance.pk:
|
||||||
|
return self.instance.token
|
||||||
|
return token
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(DeliveryEmailConfig)
|
||||||
|
class DeliveryEmailConfigAdmin(admin.ModelAdmin):
|
||||||
|
list_display = (
|
||||||
|
'name', 'host', 'port', 'username', 'is_default'
|
||||||
|
)
|
||||||
|
form = DeliveryEmailConfigForm
|
||||||
|
readonly_fields = ['id']
|
||||||
|
|
||||||
|
def change_view(self, request, object_id, form_url='', extra_context=None):
|
||||||
|
extra_context = extra_context or {}
|
||||||
|
info = self.model._meta.app_label, self.model._meta.model_name
|
||||||
|
extra_context['mailbox_test_connection_url'] = reverse(
|
||||||
|
'admin:%s_%s_test_connection' % info,
|
||||||
|
args=[object_id],
|
||||||
|
)
|
||||||
|
extra_context['mailbox_send_test_email_url'] = reverse(
|
||||||
|
'admin:%s_%s_send_test_email' % info,
|
||||||
|
args=[object_id],
|
||||||
|
)
|
||||||
|
return super().change_view(request, object_id, form_url, extra_context)
|
||||||
|
|
||||||
|
def get_urls(self):
|
||||||
|
info = self.model._meta.app_label, self.model._meta.model_name
|
||||||
|
return [
|
||||||
|
path(
|
||||||
|
'<path:object_id>/test-connection/',
|
||||||
|
self.admin_site.admin_view(delivery_email_test_connection),
|
||||||
|
name='%s_%s_test_connection' % info,
|
||||||
|
),
|
||||||
|
path(
|
||||||
|
'<path:object_id>/send-test-email/',
|
||||||
|
self.admin_site.admin_view(delivery_email_send_test_message),
|
||||||
|
name='%s_%s_send_test_email' % info,
|
||||||
|
),
|
||||||
|
] + super().get_urls()
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(DeliveryTokenConfig)
|
||||||
|
class DeliveryTokenConfigAdmin(admin.ModelAdmin):
|
||||||
|
list_display = (
|
||||||
|
'name', 'channel', 'is_default'
|
||||||
|
)
|
||||||
|
list_filter = (
|
||||||
|
'channel',
|
||||||
|
)
|
||||||
|
readonly_fields = ['id']
|
||||||
|
form = DeliveryTokenConfigForm
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(NotificationTemplate)
|
||||||
|
class NotificationTemplateAdmin(admin.ModelAdmin):
|
||||||
|
list_display = (
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
'channel',
|
||||||
|
'type',
|
||||||
|
'is_default',
|
||||||
|
)
|
||||||
|
readonly_fields = ['id']
|
||||||
|
form = forms.modelform_factory(NotificationTemplate, fields='__all__', widgets={
|
||||||
|
'subject_template': AceEditorWidget(mode='django', hide_label=False),
|
||||||
|
'body_template': AceEditorWidget(mode='django', hide_label=False),
|
||||||
|
})
|
||||||
|
save_on_top = True
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(NotificationGroup)
|
||||||
|
class NotificationGroupAdmin(admin.ModelAdmin):
|
||||||
|
list_display = (
|
||||||
|
'code',
|
||||||
|
'name',
|
||||||
|
)
|
||||||
|
search_fields = (
|
||||||
|
'code',
|
||||||
|
'name',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(NotificationType)
|
||||||
|
class NotificationTypeAdmin(admin.ModelAdmin):
|
||||||
|
list_display = (
|
||||||
|
'code',
|
||||||
|
'name',
|
||||||
|
'group',
|
||||||
|
'is_active',
|
||||||
|
)
|
||||||
|
list_filter = (
|
||||||
|
'is_active',
|
||||||
|
'group',
|
||||||
|
)
|
||||||
|
search_fields = (
|
||||||
|
'code',
|
||||||
|
'name',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(NotificationChannelPreference)
|
||||||
|
class NotificationChannelPreferenceAdmin(admin.ModelAdmin):
|
||||||
|
list_display = (
|
||||||
|
'user',
|
||||||
|
'type',
|
||||||
|
'channel',
|
||||||
|
'enabled',
|
||||||
|
)
|
||||||
|
list_filter = (
|
||||||
|
'channel',
|
||||||
|
'enabled',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class NotificationAttachmentInline(admin.TabularInline):
|
||||||
|
model = NotificationAttachment
|
||||||
|
extra = 0
|
||||||
|
can_delete = False
|
||||||
|
fields = ("name", "content_type", "size", "created_at")
|
||||||
|
readonly_fields = ("name", "content_type", "size", "created_at")
|
||||||
|
|
||||||
|
def has_add_permission(self, request, obj=None):
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
class NotificationRecipientInline(admin.TabularInline):
|
||||||
|
model = NotificationRecipient
|
||||||
|
extra = 0
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(Notification)
|
||||||
|
class NotificationAdmin(admin.ModelAdmin):
|
||||||
|
list_display = (
|
||||||
|
'verb',
|
||||||
|
'description',
|
||||||
|
'expires_at',
|
||||||
|
'created_at'
|
||||||
|
)
|
||||||
|
search_fields = (
|
||||||
|
'id',
|
||||||
|
'type__code',
|
||||||
|
'verb'
|
||||||
|
)
|
||||||
|
inlines = [NotificationAttachmentInline, NotificationRecipientInline]
|
||||||
|
|
||||||
|
def has_change_permission(self, request, obj = ...):
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(NotificationRecipient)
|
||||||
|
class NotificationRecipientAdmin(admin.ModelAdmin):
|
||||||
|
list_display = (
|
||||||
|
'user',
|
||||||
|
'notification',
|
||||||
|
'unread',
|
||||||
|
'delivery_channel',
|
||||||
|
'delivery_status',
|
||||||
|
'attempts',
|
||||||
|
)
|
||||||
|
list_filter = (
|
||||||
|
'delivery_channel',
|
||||||
|
'delivery_status',
|
||||||
|
'unread'
|
||||||
|
)
|
||||||
|
ordering = (
|
||||||
|
'-notification__created_at',
|
||||||
|
)
|
||||||
|
|
||||||
|
def get_search_fields(self, request):
|
||||||
|
username_field = get_user_model().USERNAME_FIELD
|
||||||
|
return (
|
||||||
|
'id',
|
||||||
|
f'user__{username_field}',
|
||||||
|
'notification__verb',
|
||||||
|
)
|
||||||
|
|
||||||
|
def has_change_permission(self, request, obj = ...):
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(VerificationCode)
|
||||||
|
class VerificationCodeAdmin(admin.ModelAdmin):
|
||||||
|
list_display = (
|
||||||
|
'purpose',
|
||||||
|
'channel',
|
||||||
|
'target_key',
|
||||||
|
'user',
|
||||||
|
'attempts',
|
||||||
|
'max_attempts',
|
||||||
|
'expires_at',
|
||||||
|
'consumed_at',
|
||||||
|
'created_at',
|
||||||
|
)
|
||||||
|
list_filter = (
|
||||||
|
'channel',
|
||||||
|
'purpose',
|
||||||
|
)
|
||||||
|
search_fields = (
|
||||||
|
'target_key',
|
||||||
|
'purpose',
|
||||||
|
)
|
||||||
|
exclude = ('code_hash',)
|
||||||
|
|
||||||
|
def has_add_permission(self, request):
|
||||||
|
return False
|
||||||
|
|
||||||
|
def has_change_permission(self, request, obj=None):
|
||||||
|
return False
|
||||||
|
|
@ -0,0 +1,106 @@
|
||||||
|
from django.core.mail import EmailMessage, get_connection
|
||||||
|
from django.core.exceptions import PermissionDenied
|
||||||
|
from django.http import Http404, HttpResponse
|
||||||
|
from django.views.decorators.http import require_POST
|
||||||
|
|
||||||
|
from .models import DeliveryEmailConfig
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"delivery_email_test_connection",
|
||||||
|
"delivery_email_send_test_message",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def _load_email_config(request, object_id):
|
||||||
|
try:
|
||||||
|
email_config = DeliveryEmailConfig.objects.get(pk=object_id)
|
||||||
|
except DeliveryEmailConfig.DoesNotExist:
|
||||||
|
raise Http404
|
||||||
|
|
||||||
|
if not request.user.has_perm("notify.change_deliveryemailconfig"):
|
||||||
|
raise PermissionDenied
|
||||||
|
return email_config
|
||||||
|
|
||||||
|
|
||||||
|
@require_POST
|
||||||
|
def delivery_email_test_connection(request, object_id):
|
||||||
|
email_config = _load_email_config(request, object_id)
|
||||||
|
|
||||||
|
header = "\n".join([
|
||||||
|
f"Host: {email_config.host}:{email_config.port}",
|
||||||
|
f"Login: {email_config.username}",
|
||||||
|
f"SSL: {email_config.use_ssl}, TLS: {email_config.use_tls}",
|
||||||
|
f"From: {email_config.from_email or '-'}",
|
||||||
|
"",
|
||||||
|
"--- smtp connection test ---",
|
||||||
|
"",
|
||||||
|
])
|
||||||
|
|
||||||
|
err = None
|
||||||
|
try:
|
||||||
|
connection = get_connection(**email_config.get_connection_config())
|
||||||
|
test_message = EmailMessage(
|
||||||
|
subject="SMTP connection test",
|
||||||
|
body="Connection check only. Message is not sent.",
|
||||||
|
from_email=email_config.from_email or email_config.username or "no-reply@example.com",
|
||||||
|
to=[email_config.from_email or email_config.username] if (email_config.from_email or email_config.username) else [],
|
||||||
|
connection=connection,
|
||||||
|
)
|
||||||
|
test_message.connection.open()
|
||||||
|
test_message.connection.close()
|
||||||
|
except Exception as exc:
|
||||||
|
err = exc
|
||||||
|
|
||||||
|
log = header
|
||||||
|
if err is not None:
|
||||||
|
log += f"\n\nОшибка: {type(err).__name__}"
|
||||||
|
else:
|
||||||
|
log += "\n---\nПодключение к SMTP успешно (OPEN, LOGIN, CLOSE)."
|
||||||
|
|
||||||
|
return HttpResponse(log, content_type="text/plain; charset=utf-8")
|
||||||
|
|
||||||
|
|
||||||
|
@require_POST
|
||||||
|
def delivery_email_send_test_message(request, object_id):
|
||||||
|
email_config = _load_email_config(request, object_id)
|
||||||
|
|
||||||
|
header = "\n".join([
|
||||||
|
f"Host: {email_config.host}:{email_config.port}",
|
||||||
|
f"Login: {email_config.username}",
|
||||||
|
f"SSL: {email_config.use_ssl}, TLS: {email_config.use_tls}",
|
||||||
|
f"From: {email_config.from_email or '-'}",
|
||||||
|
f"Test email: {email_config.test_email or '-'}",
|
||||||
|
"",
|
||||||
|
"--- smtp test message ---",
|
||||||
|
"",
|
||||||
|
])
|
||||||
|
|
||||||
|
if not email_config.test_email:
|
||||||
|
return HttpResponse(
|
||||||
|
header + '\nОшибка: поле "Test email" не заполнено.',
|
||||||
|
content_type="text/plain; charset=utf-8",
|
||||||
|
)
|
||||||
|
|
||||||
|
err = None
|
||||||
|
try:
|
||||||
|
connection = get_connection(**email_config.get_connection_config())
|
||||||
|
test_message = EmailMessage(
|
||||||
|
subject="SMTP test message",
|
||||||
|
body="Это тестовое письмо из админки notify.",
|
||||||
|
from_email=email_config.from_email or email_config.username or "no-reply@example.com",
|
||||||
|
to=[email_config.test_email],
|
||||||
|
connection=connection,
|
||||||
|
)
|
||||||
|
test_message.content_subtype = "plain"
|
||||||
|
sent_count = test_message.send(fail_silently=False)
|
||||||
|
except Exception as exc:
|
||||||
|
err = exc
|
||||||
|
sent_count = 0
|
||||||
|
|
||||||
|
log = header
|
||||||
|
if err is not None:
|
||||||
|
log += f"\n\nОшибка: {type(err).__name__}"
|
||||||
|
else:
|
||||||
|
log += f"\n---\nТестовое письмо отправлено. Отправлено сообщений: {sent_count}."
|
||||||
|
|
||||||
|
return HttpResponse(log, content_type="text/plain; charset=utf-8")
|
||||||
|
|
@ -0,0 +1,149 @@
|
||||||
|
import logging
|
||||||
|
from typing import List
|
||||||
|
|
||||||
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
|
from django.http import FileResponse, Http404
|
||||||
|
from django.utils import timezone
|
||||||
|
from ninja import NinjaAPI, Path, Query, Schema
|
||||||
|
from ninja.errors import ValidationError
|
||||||
|
from ninja.pagination import paginate
|
||||||
|
from ninja.security import django_auth
|
||||||
|
|
||||||
|
from .api_filters import NotificationFilterSchema
|
||||||
|
from .api_pagination import CustomPagination
|
||||||
|
from .api_schema import NotificationResponseSchema
|
||||||
|
from .models import DeliveryChannel, NotificationAttachment, NotificationRecipient
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"api",
|
||||||
|
]
|
||||||
|
|
||||||
|
api = NinjaAPI(
|
||||||
|
title="Notifications API",
|
||||||
|
version="1.0.0",
|
||||||
|
urls_namespace="notify",
|
||||||
|
docs_url="docs/",
|
||||||
|
auth=django_auth,
|
||||||
|
)
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@api.exception_handler(Http404)
|
||||||
|
def not_found(request, exc):
|
||||||
|
return api.create_response(
|
||||||
|
request,
|
||||||
|
{"message": "Not found"},
|
||||||
|
status=404,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@api.exception_handler(ObjectDoesNotExist)
|
||||||
|
def object_not_found(request, exc):
|
||||||
|
return api.create_response(
|
||||||
|
request,
|
||||||
|
{"message": "Object not found"},
|
||||||
|
status=404,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@api.exception_handler(ValidationError)
|
||||||
|
def validation_errors(request, exc):
|
||||||
|
logger.error(f"Validation Error: {exc.errors}")
|
||||||
|
return api.create_response(request, {"detail": exc.errors}, status=422)
|
||||||
|
|
||||||
|
|
||||||
|
class DetailPath(Schema):
|
||||||
|
id: str
|
||||||
|
|
||||||
|
|
||||||
|
def _base_user_queryset(user):
|
||||||
|
return NotificationRecipient.objects.filter(
|
||||||
|
user=user,
|
||||||
|
delivery_channel=DeliveryChannel.BROWSER,
|
||||||
|
notification__expires_at__gte=timezone.now(),
|
||||||
|
).select_related("notification", "notification__type").prefetch_related("notification__attachments")
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_pk(raw_id: str) -> int:
|
||||||
|
try:
|
||||||
|
value = int(str(raw_id))
|
||||||
|
except (ValueError, TypeError, AttributeError):
|
||||||
|
raise Http404
|
||||||
|
if value < 1:
|
||||||
|
raise Http404
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
def _get_user_attachment(user, raw_id: str) -> NotificationAttachment:
|
||||||
|
attachment_id = _parse_pk(raw_id)
|
||||||
|
attachment = (
|
||||||
|
NotificationAttachment.objects.filter(
|
||||||
|
id=attachment_id,
|
||||||
|
notification__expires_at__gte=timezone.now(),
|
||||||
|
notification__recipients__user=user,
|
||||||
|
)
|
||||||
|
.distinct()
|
||||||
|
.first()
|
||||||
|
)
|
||||||
|
if attachment is None:
|
||||||
|
raise Http404
|
||||||
|
return attachment
|
||||||
|
|
||||||
|
|
||||||
|
def _get_user_recipient(user, raw_id: str) -> NotificationRecipient:
|
||||||
|
return _base_user_queryset(user).get(id=_parse_pk(raw_id))
|
||||||
|
|
||||||
|
|
||||||
|
@api.get("unread-count/")
|
||||||
|
def unread_count(request):
|
||||||
|
count = _base_user_queryset(request.user).filter(unread=True).count()
|
||||||
|
return {
|
||||||
|
"result": count,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@api.post("make-read/{id}/", response=NotificationResponseSchema)
|
||||||
|
def make_read(request, path: Path[DetailPath]):
|
||||||
|
recipient = _get_user_recipient(request.user, path.id)
|
||||||
|
recipient.make_read()
|
||||||
|
return recipient
|
||||||
|
|
||||||
|
|
||||||
|
@api.post("make-unread/{id}/", response=NotificationResponseSchema)
|
||||||
|
def make_unread(request, path: Path[DetailPath]):
|
||||||
|
recipient = _get_user_recipient(request.user, path.id)
|
||||||
|
recipient.make_unread()
|
||||||
|
return recipient
|
||||||
|
|
||||||
|
|
||||||
|
@api.post("make-all-read/")
|
||||||
|
def make_all_read(request, filters: NotificationFilterSchema = Query(...)):
|
||||||
|
qs = filters.filter(_base_user_queryset(request.user))
|
||||||
|
qs.filter(unread=True).update(unread=False)
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
|
@api.get("count/")
|
||||||
|
def count(request, filters: NotificationFilterSchema = Query(...)):
|
||||||
|
qs = filters.filter(_base_user_queryset(request.user))
|
||||||
|
return dict(result=qs.count())
|
||||||
|
|
||||||
|
|
||||||
|
@api.get("attachments/{id}/")
|
||||||
|
def download_attachment(request, path: Path[DetailPath]):
|
||||||
|
attachment = _get_user_attachment(request.user, path.id)
|
||||||
|
uploaded = attachment.file.open("rb")
|
||||||
|
return FileResponse(
|
||||||
|
uploaded,
|
||||||
|
as_attachment=True,
|
||||||
|
filename=attachment.name,
|
||||||
|
content_type=attachment.content_type or "application/octet-stream",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@api.get("list/", response=List[NotificationResponseSchema])
|
||||||
|
@paginate(CustomPagination)
|
||||||
|
def list(request, filters: NotificationFilterSchema = Query(...)):
|
||||||
|
qs = filters.filter(_base_user_queryset(request.user))
|
||||||
|
qs = qs.order_by("-created_at")
|
||||||
|
return qs
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
|
||||||
|
from typing import Optional, List, Annotated
|
||||||
|
from django.db.models import Q
|
||||||
|
from ninja import (
|
||||||
|
FilterSchema,
|
||||||
|
FilterLookup
|
||||||
|
)
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"NotificationFilterSchema",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class NotificationFilterSchema(FilterSchema):
|
||||||
|
unread: Optional[bool] = None
|
||||||
|
type: Annotated[Optional[str], FilterLookup("notification__type__code")] = None
|
||||||
|
type__startswith: Annotated[Optional[str], FilterLookup("notification__type__code__startswith")] = None
|
||||||
|
object_id: Annotated[Optional[str], FilterLookup("notification__object_id")] = None
|
||||||
|
search: Annotated[
|
||||||
|
Optional[str],
|
||||||
|
FilterLookup(
|
||||||
|
["notification__verb__icontains", "notification__description__icontains"],
|
||||||
|
expression_connector="OR"
|
||||||
|
)
|
||||||
|
] = None
|
||||||
|
object_id__ne: Optional[List[str]] = None
|
||||||
|
object_id__ne__in: Optional[str] = None
|
||||||
|
|
||||||
|
def filter_object_id__ne(self, value: List[str]) -> Q:
|
||||||
|
return ~Q(notification__object_id__in=value)
|
||||||
|
|
||||||
|
def filter_object_id__ne__in(self, value: str) -> Q:
|
||||||
|
if value:
|
||||||
|
value = value.split(',')
|
||||||
|
return ~Q(notification__object_id__in=value)
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
|
||||||
|
import math
|
||||||
|
from typing import List, Any
|
||||||
|
|
||||||
|
from django.db.models import QuerySet
|
||||||
|
from ninja import (
|
||||||
|
Schema,
|
||||||
|
Field,
|
||||||
|
)
|
||||||
|
from ninja.pagination import PageNumberPagination
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"CustomPagination",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class CustomPagination(PageNumberPagination):
|
||||||
|
|
||||||
|
class Input(Schema):
|
||||||
|
page: int = Field(1, ge=1)
|
||||||
|
|
||||||
|
items_attribute: str = "results"
|
||||||
|
|
||||||
|
class Output(Schema):
|
||||||
|
results: List[Any]
|
||||||
|
total: int
|
||||||
|
pagination: Any
|
||||||
|
|
||||||
|
def paginate_queryset(
|
||||||
|
self,
|
||||||
|
queryset: QuerySet,
|
||||||
|
pagination: Input,
|
||||||
|
**params: Any,
|
||||||
|
) -> Any:
|
||||||
|
offset = (pagination.page - 1) * self.page_size
|
||||||
|
paginated_qs = queryset[offset: offset + self.page_size]
|
||||||
|
total = self._items_count(queryset)
|
||||||
|
return {
|
||||||
|
"results": list(paginated_qs),
|
||||||
|
"total": total,
|
||||||
|
"pagination": {
|
||||||
|
"page": pagination.page,
|
||||||
|
"total_pages": math.ceil(total / self.page_size),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
from django.urls import reverse
|
||||||
|
from ninja import Field, ModelSchema, Schema
|
||||||
|
|
||||||
|
from .models import NotificationRecipient
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"AttachmentSchema",
|
||||||
|
"NotificationResponseSchema",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class AttachmentSchema(Schema):
|
||||||
|
id: int
|
||||||
|
name: str
|
||||||
|
size: int
|
||||||
|
content_type: str
|
||||||
|
url: str
|
||||||
|
|
||||||
|
|
||||||
|
class NotificationResponseSchema(ModelSchema):
|
||||||
|
url: Optional[str] = Field(alias="notification.url")
|
||||||
|
type: Optional[str] = None
|
||||||
|
level: Optional[str] = Field(alias="notification.level")
|
||||||
|
verb: Optional[str] = Field(alias="notification.verb")
|
||||||
|
object_id: Optional[str] = Field(alias="notification.object_id")
|
||||||
|
description: Optional[str] = Field(alias="notification.description")
|
||||||
|
data: dict = Field(alias="notification.data")
|
||||||
|
attachments: list[AttachmentSchema]
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = NotificationRecipient
|
||||||
|
fields = [
|
||||||
|
"id",
|
||||||
|
"unread",
|
||||||
|
"created_at",
|
||||||
|
]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def resolve_type(obj):
|
||||||
|
notification_type = obj.notification.type
|
||||||
|
if notification_type is None:
|
||||||
|
return None
|
||||||
|
return notification_type.code
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def resolve_attachments(obj):
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
"id": attachment.id,
|
||||||
|
"name": attachment.name,
|
||||||
|
"size": attachment.size,
|
||||||
|
"content_type": attachment.content_type,
|
||||||
|
"url": reverse("notify:download_attachment", kwargs={"id": attachment.id}),
|
||||||
|
}
|
||||||
|
for attachment in obj.notification.attachments.all()
|
||||||
|
]
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"NotifyConfig",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class NotifyConfig(AppConfig):
|
||||||
|
default_auto_field = "django.db.models.BigAutoField"
|
||||||
|
name = "notify"
|
||||||
|
verbose_name = "Notifications"
|
||||||
|
|
||||||
|
def ready(self):
|
||||||
|
from notify.delivery.providers import register_builtin_providers
|
||||||
|
|
||||||
|
register_builtin_providers()
|
||||||
|
import notify.receivers # noqa: F401
|
||||||
|
|
@ -0,0 +1,95 @@
|
||||||
|
import mimetypes
|
||||||
|
import os
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.core.files.base import ContentFile
|
||||||
|
|
||||||
|
from notify.models import NotificationAttachment
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"DEFAULT_MAX_ATTACHMENT_BYTES",
|
||||||
|
"DEFAULT_MAX_ATTACHMENTS",
|
||||||
|
"discard_attachments",
|
||||||
|
"max_attachment_bytes",
|
||||||
|
"max_attachments",
|
||||||
|
"prepare_attachments",
|
||||||
|
"store_attachments",
|
||||||
|
]
|
||||||
|
|
||||||
|
DEFAULT_MAX_ATTACHMENTS = 10
|
||||||
|
DEFAULT_MAX_ATTACHMENT_BYTES = 10 * 1024 * 1024
|
||||||
|
|
||||||
|
|
||||||
|
def max_attachments():
|
||||||
|
return int(getattr(settings, "NOTIFY_MAX_ATTACHMENTS", DEFAULT_MAX_ATTACHMENTS))
|
||||||
|
|
||||||
|
|
||||||
|
def max_attachment_bytes():
|
||||||
|
return int(getattr(settings, "NOTIFY_MAX_ATTACHMENT_BYTES", DEFAULT_MAX_ATTACHMENT_BYTES))
|
||||||
|
|
||||||
|
|
||||||
|
def clean_filename(raw):
|
||||||
|
name = os.path.basename(str(raw).replace("\\", "/")).replace("\x00", "").strip()
|
||||||
|
if name in {"", ".", ".."}:
|
||||||
|
return ""
|
||||||
|
return name[:255]
|
||||||
|
|
||||||
|
|
||||||
|
def prepare_attachments(attachments):
|
||||||
|
if not attachments:
|
||||||
|
return []
|
||||||
|
files = list(attachments)
|
||||||
|
limit = max_attachments()
|
||||||
|
if len(files) > limit:
|
||||||
|
raise ValueError(f"At most {limit} attachments are allowed")
|
||||||
|
return [_read_attachment(uploaded) for uploaded in files]
|
||||||
|
|
||||||
|
|
||||||
|
def store_attachments(notification, prepared, stored):
|
||||||
|
for item in prepared:
|
||||||
|
row = NotificationAttachment(
|
||||||
|
notification=notification,
|
||||||
|
name=item["name"],
|
||||||
|
content_type=item["content_type"],
|
||||||
|
size=item["size"],
|
||||||
|
)
|
||||||
|
row.file.save(item["name"], ContentFile(item["content"]), save=False)
|
||||||
|
stored.append(row)
|
||||||
|
row.save()
|
||||||
|
|
||||||
|
|
||||||
|
def discard_attachments(stored):
|
||||||
|
for row in stored:
|
||||||
|
if row.file:
|
||||||
|
row.file.delete(save=False)
|
||||||
|
|
||||||
|
|
||||||
|
def _read_attachment(uploaded):
|
||||||
|
if not hasattr(uploaded, "read"):
|
||||||
|
raise ValueError("Attachment must be a file")
|
||||||
|
name = clean_filename(getattr(uploaded, "name", "") or "")
|
||||||
|
if not name:
|
||||||
|
raise ValueError("Attachment must have a file name")
|
||||||
|
declared = getattr(uploaded, "size", None)
|
||||||
|
if declared is not None and declared > max_attachment_bytes():
|
||||||
|
raise ValueError(f"Attachment {name} exceeds the size limit")
|
||||||
|
if hasattr(uploaded, "seek"):
|
||||||
|
try:
|
||||||
|
uploaded.seek(0)
|
||||||
|
except (OSError, ValueError):
|
||||||
|
pass
|
||||||
|
content = uploaded.read()
|
||||||
|
if isinstance(content, str):
|
||||||
|
content = content.encode()
|
||||||
|
if content is None:
|
||||||
|
content = b""
|
||||||
|
if len(content) > max_attachment_bytes():
|
||||||
|
raise ValueError(f"Attachment {name} exceeds the size limit")
|
||||||
|
content_type = getattr(uploaded, "content_type", None) or mimetypes.guess_type(name)[0]
|
||||||
|
content_type = (content_type or "application/octet-stream").split(";", 1)[0].strip()
|
||||||
|
return {
|
||||||
|
"name": name,
|
||||||
|
"content": content,
|
||||||
|
"size": len(content),
|
||||||
|
"content_type": content_type[:255] or "application/octet-stream",
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,179 @@
|
||||||
|
import math
|
||||||
|
import secrets
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import transaction
|
||||||
|
from django.utils import timezone
|
||||||
|
from django.utils.html import escape
|
||||||
|
|
||||||
|
from notify.delivery import get_provider
|
||||||
|
from notify.models import NotificationTemplate, NotificationType, VerificationCode
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"CodeThrottled",
|
||||||
|
"send_code",
|
||||||
|
"verify_code",
|
||||||
|
]
|
||||||
|
|
||||||
|
DEFAULT_CODE_LENGTH = 6
|
||||||
|
DEFAULT_CODE_TTL = 300
|
||||||
|
DEFAULT_CODE_MAX_ATTEMPTS = 5
|
||||||
|
DEFAULT_CODE_RESEND_INTERVAL = 60
|
||||||
|
|
||||||
|
DEFAULT_SUBJECT = "Код подтверждения"
|
||||||
|
|
||||||
|
|
||||||
|
class CodeThrottled(Exception):
|
||||||
|
def __init__(self, retry_after: int):
|
||||||
|
self.retry_after = retry_after
|
||||||
|
super().__init__(f"Code was sent recently, retry after {retry_after} seconds")
|
||||||
|
|
||||||
|
|
||||||
|
def _code_length():
|
||||||
|
return int(getattr(settings, "NOTIFY_CODE_LENGTH", DEFAULT_CODE_LENGTH))
|
||||||
|
|
||||||
|
|
||||||
|
def _code_ttl():
|
||||||
|
return int(getattr(settings, "NOTIFY_CODE_TTL", DEFAULT_CODE_TTL))
|
||||||
|
|
||||||
|
|
||||||
|
def _code_max_attempts():
|
||||||
|
return int(getattr(settings, "NOTIFY_CODE_MAX_ATTEMPTS", DEFAULT_CODE_MAX_ATTEMPTS))
|
||||||
|
|
||||||
|
|
||||||
|
def _code_resend_interval():
|
||||||
|
return int(getattr(settings, "NOTIFY_CODE_RESEND_INTERVAL", DEFAULT_CODE_RESEND_INTERVAL))
|
||||||
|
|
||||||
|
|
||||||
|
def _resolve_target(channel, target):
|
||||||
|
provider = get_provider(channel)
|
||||||
|
if provider is None or not provider.supports_codes:
|
||||||
|
raise ValueError(f"Channel {channel} does not support codes")
|
||||||
|
target = provider.validate_target(target)
|
||||||
|
return provider, target, provider.target_key(target)
|
||||||
|
|
||||||
|
|
||||||
|
def _resolve_type(notification_type):
|
||||||
|
if notification_type is None or isinstance(notification_type, NotificationType):
|
||||||
|
return notification_type
|
||||||
|
return NotificationType.objects.get(code=notification_type)
|
||||||
|
|
||||||
|
|
||||||
|
def _generate_code(length):
|
||||||
|
return str(secrets.randbelow(10**length)).zfill(length)
|
||||||
|
|
||||||
|
|
||||||
|
def _ttl_minutes(ttl):
|
||||||
|
return max(1, math.ceil(ttl / 60))
|
||||||
|
|
||||||
|
|
||||||
|
def _render(channel, notification_type, code, ttl, purpose, user):
|
||||||
|
template = None
|
||||||
|
if notification_type is not None:
|
||||||
|
template = (
|
||||||
|
NotificationTemplate.objects.filter(channel=channel, type=notification_type)
|
||||||
|
.order_by("id")
|
||||||
|
.first()
|
||||||
|
)
|
||||||
|
ttl_minutes = _ttl_minutes(ttl)
|
||||||
|
if template is not None:
|
||||||
|
context = {
|
||||||
|
"code": code,
|
||||||
|
"ttl_minutes": ttl_minutes,
|
||||||
|
"purpose": purpose,
|
||||||
|
"user": {"id": user.pk, "username": user.get_username()} if user is not None else None,
|
||||||
|
}
|
||||||
|
subject = " ".join(template.render_subject(context).split()) or DEFAULT_SUBJECT
|
||||||
|
return subject, template.render_body(context)
|
||||||
|
text = f"Код подтверждения: {code}. Действует {ttl_minutes} мин."
|
||||||
|
if channel == "email":
|
||||||
|
return DEFAULT_SUBJECT, f"<p>{escape(text)}</p>"
|
||||||
|
return DEFAULT_SUBJECT, text
|
||||||
|
|
||||||
|
|
||||||
|
def _active_codes(purpose, channel, target_key):
|
||||||
|
return VerificationCode.objects.filter(
|
||||||
|
purpose=purpose,
|
||||||
|
channel=channel,
|
||||||
|
target_key=target_key,
|
||||||
|
consumed_at__isnull=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def send_code(
|
||||||
|
*,
|
||||||
|
purpose: str,
|
||||||
|
channel: str,
|
||||||
|
target: dict | None = None,
|
||||||
|
user=None,
|
||||||
|
type: NotificationType | str | None = None,
|
||||||
|
) -> VerificationCode:
|
||||||
|
if not purpose:
|
||||||
|
raise ValueError("purpose is required")
|
||||||
|
provider, target, target_key = _resolve_target(channel, target)
|
||||||
|
notification_type = _resolve_type(type)
|
||||||
|
now = timezone.now()
|
||||||
|
ttl = _code_ttl()
|
||||||
|
resend_interval = _code_resend_interval()
|
||||||
|
|
||||||
|
with transaction.atomic():
|
||||||
|
last = (
|
||||||
|
VerificationCode.objects.select_for_update()
|
||||||
|
.filter(purpose=purpose, channel=channel, target_key=target_key)
|
||||||
|
.order_by("-created_at")
|
||||||
|
.first()
|
||||||
|
)
|
||||||
|
if last is not None and resend_interval > 0:
|
||||||
|
elapsed = (now - last.created_at).total_seconds()
|
||||||
|
if elapsed < resend_interval:
|
||||||
|
raise CodeThrottled(math.ceil(resend_interval - elapsed))
|
||||||
|
|
||||||
|
_active_codes(purpose, channel, target_key).update(consumed_at=now)
|
||||||
|
|
||||||
|
code = _generate_code(_code_length())
|
||||||
|
verification = VerificationCode(
|
||||||
|
user=user,
|
||||||
|
purpose=purpose,
|
||||||
|
channel=channel,
|
||||||
|
target_key=target_key,
|
||||||
|
delivery_target=target.model_dump(),
|
||||||
|
expires_at=now + timedelta(seconds=ttl),
|
||||||
|
max_attempts=_code_max_attempts(),
|
||||||
|
)
|
||||||
|
verification.set_code(code)
|
||||||
|
verification.save()
|
||||||
|
|
||||||
|
subject, body = _render(channel, notification_type, code, ttl, purpose, user)
|
||||||
|
provider.send_message(target, subject, body)
|
||||||
|
return verification
|
||||||
|
|
||||||
|
|
||||||
|
def verify_code(
|
||||||
|
*,
|
||||||
|
purpose: str,
|
||||||
|
channel: str,
|
||||||
|
code: str,
|
||||||
|
target: dict | None = None,
|
||||||
|
) -> bool:
|
||||||
|
_, _, target_key = _resolve_target(channel, target)
|
||||||
|
code = "".join(str(code or "").split())
|
||||||
|
if not code:
|
||||||
|
return False
|
||||||
|
with transaction.atomic():
|
||||||
|
verification = (
|
||||||
|
_active_codes(purpose, channel, target_key)
|
||||||
|
.select_for_update()
|
||||||
|
.order_by("-created_at")
|
||||||
|
.first()
|
||||||
|
)
|
||||||
|
if verification is None or verification.is_expired:
|
||||||
|
return False
|
||||||
|
if verification.attempts >= verification.max_attempts:
|
||||||
|
return False
|
||||||
|
verification.attempts += 1
|
||||||
|
matched = verification.check_code(code)
|
||||||
|
if matched:
|
||||||
|
verification.consumed_at = timezone.now()
|
||||||
|
verification.save(update_fields=["attempts", "consumed_at"])
|
||||||
|
return matched
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
from .base import DeliveryProvider, render_notification_template
|
||||||
|
from .registry import get_provider, get_provider_or_raise, register, registered_channels
|
||||||
|
from .providers import register_builtin_providers
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
'DeliveryProvider',
|
||||||
|
'render_notification_template',
|
||||||
|
'get_provider',
|
||||||
|
'get_provider_or_raise',
|
||||||
|
'register',
|
||||||
|
'registered_channels',
|
||||||
|
'register_builtin_providers',
|
||||||
|
]
|
||||||
|
|
@ -0,0 +1,121 @@
|
||||||
|
from abc import ABC, abstractmethod
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
from django.utils import timezone
|
||||||
|
from django.utils.html import linebreaks
|
||||||
|
from pydantic import BaseModel
|
||||||
|
from pydantic import ValidationError as PydanticValidationError
|
||||||
|
|
||||||
|
from notify.delivery.exceptions import PermanentDeliveryError
|
||||||
|
from notify.models import (
|
||||||
|
DeliveryChannel,
|
||||||
|
DeliveryStatus,
|
||||||
|
NotificationRecipient,
|
||||||
|
NotificationTemplate,
|
||||||
|
)
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"template_context",
|
||||||
|
"render_notification_template",
|
||||||
|
"DeliveryProvider",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def _single_line(value: str | None) -> str:
|
||||||
|
return " ".join((value or "").split())
|
||||||
|
|
||||||
|
|
||||||
|
def template_context(notification_recipient: NotificationRecipient) -> dict:
|
||||||
|
notification = notification_recipient.notification
|
||||||
|
user = notification_recipient.user
|
||||||
|
username_field = user.__class__.USERNAME_FIELD
|
||||||
|
return {
|
||||||
|
"recipient": {
|
||||||
|
"id": str(notification_recipient.id),
|
||||||
|
"delivery_channel": notification_recipient.delivery_channel,
|
||||||
|
"delivery_target": notification_recipient.delivery_target,
|
||||||
|
},
|
||||||
|
"notification": {
|
||||||
|
"id": str(notification.id),
|
||||||
|
"url": notification.url,
|
||||||
|
"level": notification.level,
|
||||||
|
"verb": notification.verb,
|
||||||
|
"object_id": notification.object_id,
|
||||||
|
"description": notification.description,
|
||||||
|
"data": notification.data,
|
||||||
|
},
|
||||||
|
"user": {
|
||||||
|
"id": user.pk,
|
||||||
|
"username": getattr(user, username_field, ""),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def render_notification_template(
|
||||||
|
delivery_channel: DeliveryChannel,
|
||||||
|
notification_recipient: NotificationRecipient,
|
||||||
|
) -> tuple[str, str | None]:
|
||||||
|
notification = notification_recipient.notification
|
||||||
|
template = NotificationTemplate.for_delivery(delivery_channel, notification.type)
|
||||||
|
if template:
|
||||||
|
context = template_context(notification_recipient)
|
||||||
|
subject = _single_line(template.render_subject(context))
|
||||||
|
body = template.render_body(context)
|
||||||
|
else:
|
||||||
|
subject = _single_line(notification.verb)
|
||||||
|
body = linebreaks(notification.description or "", autoescape=True)
|
||||||
|
return subject, body
|
||||||
|
|
||||||
|
|
||||||
|
class DeliveryProvider(ABC):
|
||||||
|
channel: DeliveryChannel
|
||||||
|
target_schema: Optional[type[BaseModel]] = None
|
||||||
|
requires_async_delivery: bool = True
|
||||||
|
supports_codes: bool = False
|
||||||
|
|
||||||
|
def validate_target(self, raw: Optional[dict]) -> Optional[BaseModel]:
|
||||||
|
if self.target_schema is None:
|
||||||
|
if raw:
|
||||||
|
raise ValueError(f"target is not supported when channel is {self.channel}")
|
||||||
|
return None
|
||||||
|
if not raw:
|
||||||
|
raise ValueError(f"target is required when channel is {self.channel}")
|
||||||
|
try:
|
||||||
|
return self.target_schema.model_validate(raw)
|
||||||
|
except PydanticValidationError as exc:
|
||||||
|
raise ValueError(exc.errors()[0]["msg"]) from exc
|
||||||
|
|
||||||
|
def parse_target(self, raw: Optional[dict]) -> Optional[BaseModel]:
|
||||||
|
if self.target_schema is None or raw is None:
|
||||||
|
return None
|
||||||
|
try:
|
||||||
|
return self.target_schema.model_validate(raw)
|
||||||
|
except PydanticValidationError as exc:
|
||||||
|
raise PermanentDeliveryError(f"Invalid {self.channel} target: {exc.errors()[0]['msg']}") from exc
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def send(self, recipient: NotificationRecipient) -> None:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def send_message(
|
||||||
|
self,
|
||||||
|
target: Optional[BaseModel],
|
||||||
|
subject: str,
|
||||||
|
body: str,
|
||||||
|
attachments=(),
|
||||||
|
) -> None:
|
||||||
|
raise NotImplementedError(f"{type(self).__name__} does not support direct messages")
|
||||||
|
|
||||||
|
def target_key(self, target: BaseModel) -> str:
|
||||||
|
raise NotImplementedError(f"{type(self).__name__} does not support codes")
|
||||||
|
|
||||||
|
def mark_sent(self, recipient: NotificationRecipient) -> None:
|
||||||
|
recipient.delivery_status = DeliveryStatus.SENT
|
||||||
|
recipient.sent_at = timezone.now()
|
||||||
|
recipient.last_error = ""
|
||||||
|
recipient.save(update_fields=["delivery_status", "sent_at", "last_error"])
|
||||||
|
|
||||||
|
def enqueue(self, recipient_id) -> None:
|
||||||
|
from notify.tasks import deliver_notification
|
||||||
|
|
||||||
|
deliver_notification.apply_async(args=(str(recipient_id),))
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
__all__ = [
|
||||||
|
"DeliveryError",
|
||||||
|
"PermanentDeliveryError",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class DeliveryError(Exception):
|
||||||
|
"""Temporary delivery failure. The worker may retry."""
|
||||||
|
|
||||||
|
|
||||||
|
class PermanentDeliveryError(DeliveryError):
|
||||||
|
"""Delivery cannot succeed on another attempt."""
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
from notify.delivery.registry import register
|
||||||
|
from .browser import BrowserDeliveryProvider
|
||||||
|
from .email import EmailDeliveryProvider
|
||||||
|
from .max import MaxDeliveryProvider
|
||||||
|
from .telegram import TelegramDeliveryProvider
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
'register_builtin_providers',
|
||||||
|
'BrowserDeliveryProvider',
|
||||||
|
'EmailDeliveryProvider',
|
||||||
|
'MaxDeliveryProvider',
|
||||||
|
'TelegramDeliveryProvider',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def register_builtin_providers() -> None:
|
||||||
|
for provider in (
|
||||||
|
BrowserDeliveryProvider(),
|
||||||
|
EmailDeliveryProvider(),
|
||||||
|
MaxDeliveryProvider(),
|
||||||
|
TelegramDeliveryProvider(),
|
||||||
|
):
|
||||||
|
register(provider)
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
from notify.delivery.base import DeliveryProvider
|
||||||
|
from notify.models import DeliveryChannel, NotificationRecipient
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
'BrowserDeliveryProvider',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class BrowserDeliveryProvider(DeliveryProvider):
|
||||||
|
channel = DeliveryChannel.BROWSER
|
||||||
|
requires_async_delivery = False
|
||||||
|
|
||||||
|
def send(self, recipient: NotificationRecipient) -> None:
|
||||||
|
self.mark_sent(recipient)
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
from django.core.mail import EmailMessage, get_connection
|
||||||
|
from pydantic import BaseModel, EmailStr
|
||||||
|
|
||||||
|
from notify.delivery.base import DeliveryProvider, render_notification_template
|
||||||
|
from notify.delivery.exceptions import DeliveryError, PermanentDeliveryError
|
||||||
|
from notify.models import DeliveryChannel, DeliveryEmailConfig, NotificationRecipient
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
'EmailTargetSchema',
|
||||||
|
'EmailDeliveryProvider',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class EmailTargetSchema(BaseModel):
|
||||||
|
email: EmailStr
|
||||||
|
|
||||||
|
|
||||||
|
class EmailDeliveryProvider(DeliveryProvider):
|
||||||
|
channel = DeliveryChannel.EMAIL
|
||||||
|
target_schema = EmailTargetSchema
|
||||||
|
supports_codes = True
|
||||||
|
|
||||||
|
def target_key(self, target: EmailTargetSchema) -> str:
|
||||||
|
return target.email.lower()
|
||||||
|
|
||||||
|
def send(self, recipient: NotificationRecipient) -> None:
|
||||||
|
subject, body = render_notification_template(DeliveryChannel.EMAIL, recipient)
|
||||||
|
self.send_message(
|
||||||
|
self.parse_target(recipient.delivery_target),
|
||||||
|
subject,
|
||||||
|
body,
|
||||||
|
attachments=recipient.notification.attachments.all(),
|
||||||
|
)
|
||||||
|
self.mark_sent(recipient)
|
||||||
|
|
||||||
|
def send_message(
|
||||||
|
self,
|
||||||
|
target: Optional[EmailTargetSchema],
|
||||||
|
subject: str,
|
||||||
|
body: str,
|
||||||
|
attachments=(),
|
||||||
|
) -> None:
|
||||||
|
delivery_config = DeliveryEmailConfig.get_default()
|
||||||
|
if delivery_config is None:
|
||||||
|
raise DeliveryError("No default email delivery config")
|
||||||
|
if target is None:
|
||||||
|
raise PermanentDeliveryError("Email recipient has no email")
|
||||||
|
|
||||||
|
try:
|
||||||
|
email_connection = get_connection(**delivery_config.get_connection_config())
|
||||||
|
msg = EmailMessage(
|
||||||
|
subject,
|
||||||
|
body=body,
|
||||||
|
from_email=delivery_config.from_email,
|
||||||
|
to=[target.email],
|
||||||
|
connection=email_connection,
|
||||||
|
)
|
||||||
|
msg.content_subtype = "html"
|
||||||
|
for attachment in attachments:
|
||||||
|
with attachment.file.open("rb") as uploaded:
|
||||||
|
payload = uploaded.read()
|
||||||
|
msg.attach(attachment.name, payload, attachment.content_type)
|
||||||
|
sent = msg.send(fail_silently=False)
|
||||||
|
except ValueError as exc:
|
||||||
|
raise PermanentDeliveryError(str(exc)) from exc
|
||||||
|
except DeliveryError:
|
||||||
|
raise
|
||||||
|
except Exception as exc:
|
||||||
|
raise DeliveryError("Email delivery failed") from exc
|
||||||
|
if not sent:
|
||||||
|
raise DeliveryError("Email was not accepted for delivery")
|
||||||
|
|
@ -0,0 +1,87 @@
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
import requests
|
||||||
|
from pydantic import BaseModel, model_validator
|
||||||
|
|
||||||
|
from notify.delivery.base import DeliveryProvider, render_notification_template
|
||||||
|
from notify.delivery.exceptions import DeliveryError, PermanentDeliveryError
|
||||||
|
from notify.models import DeliveryChannel, DeliveryTokenConfig, NotificationRecipient
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
'MAX_API_TIMEOUT',
|
||||||
|
'MaxTargetSchema',
|
||||||
|
'MaxDeliveryProvider',
|
||||||
|
]
|
||||||
|
|
||||||
|
MAX_API_TIMEOUT = 10
|
||||||
|
|
||||||
|
|
||||||
|
class MaxTargetSchema(BaseModel):
|
||||||
|
chat_id: int
|
||||||
|
user_id: Optional[int] = None
|
||||||
|
|
||||||
|
@model_validator(mode="after")
|
||||||
|
def validate_ids(self):
|
||||||
|
if self.user_id is None:
|
||||||
|
if self.chat_id >= 0:
|
||||||
|
raise ValueError("chat_id must be negative when user_id is not specified")
|
||||||
|
elif self.chat_id <= 0 or self.user_id <= 0:
|
||||||
|
raise ValueError("chat_id and user_id must be positive when both are specified")
|
||||||
|
return self
|
||||||
|
|
||||||
|
|
||||||
|
class MaxDeliveryProvider(DeliveryProvider):
|
||||||
|
channel = DeliveryChannel.MAX
|
||||||
|
target_schema = MaxTargetSchema
|
||||||
|
supports_codes = True
|
||||||
|
|
||||||
|
def target_key(self, target: MaxTargetSchema) -> str:
|
||||||
|
if target.user_id:
|
||||||
|
return f"user:{target.user_id}"
|
||||||
|
return f"chat:{target.chat_id}"
|
||||||
|
|
||||||
|
def send(self, recipient: NotificationRecipient) -> None:
|
||||||
|
_, body = render_notification_template(DeliveryChannel.MAX, recipient)
|
||||||
|
self.send_message(self.parse_target(recipient.delivery_target), "", body)
|
||||||
|
self.mark_sent(recipient)
|
||||||
|
|
||||||
|
def send_message(
|
||||||
|
self,
|
||||||
|
target: Optional[MaxTargetSchema],
|
||||||
|
subject: str,
|
||||||
|
body: str,
|
||||||
|
attachments=(),
|
||||||
|
) -> None:
|
||||||
|
delivery_config = DeliveryTokenConfig.get_default(DeliveryChannel.MAX)
|
||||||
|
if delivery_config is None:
|
||||||
|
raise DeliveryError("No default MAX delivery config")
|
||||||
|
if target is None:
|
||||||
|
raise PermanentDeliveryError("MAX recipient has no chat_id")
|
||||||
|
|
||||||
|
request_params = {}
|
||||||
|
if target.user_id:
|
||||||
|
request_params["user_id"] = target.user_id
|
||||||
|
else:
|
||||||
|
request_params["chat_id"] = target.chat_id
|
||||||
|
|
||||||
|
try:
|
||||||
|
response = requests.post(
|
||||||
|
"https://platform-api.max.ru/messages",
|
||||||
|
params=request_params,
|
||||||
|
headers={"Authorization": delivery_config.token},
|
||||||
|
json={
|
||||||
|
"chat_id": target.chat_id,
|
||||||
|
"text": body,
|
||||||
|
},
|
||||||
|
timeout=MAX_API_TIMEOUT,
|
||||||
|
)
|
||||||
|
response.raise_for_status()
|
||||||
|
except requests.Timeout as exc:
|
||||||
|
raise DeliveryError("MAX request timed out") from exc
|
||||||
|
except requests.HTTPError as exc:
|
||||||
|
status = exc.response.status_code if exc.response is not None else 0
|
||||||
|
if status == 429 or status >= 500:
|
||||||
|
raise DeliveryError(f"MAX API temporary error: {status}") from exc
|
||||||
|
raise PermanentDeliveryError(f"MAX API rejected the message: {status}") from exc
|
||||||
|
except requests.RequestException as exc:
|
||||||
|
raise DeliveryError("MAX request failed") from exc
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
import requests
|
||||||
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
from notify.delivery.base import DeliveryProvider, render_notification_template
|
||||||
|
from notify.delivery.exceptions import DeliveryError, PermanentDeliveryError
|
||||||
|
from notify.models import DeliveryChannel, DeliveryTokenConfig, NotificationRecipient
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"TELEGRAM_API_TIMEOUT",
|
||||||
|
"TelegramTargetSchema",
|
||||||
|
"TelegramDeliveryProvider",
|
||||||
|
]
|
||||||
|
|
||||||
|
TELEGRAM_API_TIMEOUT = 10
|
||||||
|
|
||||||
|
|
||||||
|
class TelegramTargetSchema(BaseModel):
|
||||||
|
chat_id: int
|
||||||
|
|
||||||
|
|
||||||
|
class TelegramDeliveryProvider(DeliveryProvider):
|
||||||
|
channel = DeliveryChannel.TELEGRAM
|
||||||
|
target_schema = TelegramTargetSchema
|
||||||
|
supports_codes = True
|
||||||
|
|
||||||
|
def target_key(self, target: TelegramTargetSchema) -> str:
|
||||||
|
return str(target.chat_id)
|
||||||
|
|
||||||
|
def send(self, recipient: NotificationRecipient) -> None:
|
||||||
|
_, body = render_notification_template(DeliveryChannel.TELEGRAM, recipient)
|
||||||
|
self.send_message(self.parse_target(recipient.delivery_target), "", body)
|
||||||
|
self.mark_sent(recipient)
|
||||||
|
|
||||||
|
def send_message(
|
||||||
|
self,
|
||||||
|
target: Optional[TelegramTargetSchema],
|
||||||
|
subject: str,
|
||||||
|
body: str,
|
||||||
|
attachments=(),
|
||||||
|
) -> None:
|
||||||
|
delivery_config = DeliveryTokenConfig.get_default(DeliveryChannel.TELEGRAM)
|
||||||
|
if delivery_config is None:
|
||||||
|
raise DeliveryError("No default Telegram delivery config")
|
||||||
|
if target is None:
|
||||||
|
raise PermanentDeliveryError("Telegram recipient has no chat_id")
|
||||||
|
|
||||||
|
try:
|
||||||
|
response = requests.post(
|
||||||
|
f"https://api.telegram.org/bot{delivery_config.token}/sendMessage",
|
||||||
|
json={"chat_id": target.chat_id, "text": body},
|
||||||
|
timeout=TELEGRAM_API_TIMEOUT,
|
||||||
|
)
|
||||||
|
response.raise_for_status()
|
||||||
|
except requests.Timeout as exc:
|
||||||
|
raise DeliveryError("Telegram request timed out") from exc
|
||||||
|
except requests.HTTPError as exc:
|
||||||
|
status = exc.response.status_code if exc.response is not None else 0
|
||||||
|
if status == 429 or status >= 500:
|
||||||
|
raise DeliveryError(f"Telegram API temporary error: {status}") from exc
|
||||||
|
raise PermanentDeliveryError(f"Telegram API rejected the message: {status}") from exc
|
||||||
|
except requests.RequestException as exc:
|
||||||
|
raise DeliveryError("Telegram request failed") from exc
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
from typing import Iterable
|
||||||
|
|
||||||
|
from .base import DeliveryProvider
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
'register',
|
||||||
|
'get_provider',
|
||||||
|
'get_provider_or_raise',
|
||||||
|
'registered_channels',
|
||||||
|
]
|
||||||
|
|
||||||
|
_providers: dict[str, DeliveryProvider] = {}
|
||||||
|
|
||||||
|
|
||||||
|
def _channel_key(channel) -> str:
|
||||||
|
return str(channel)
|
||||||
|
|
||||||
|
|
||||||
|
def register(provider: DeliveryProvider) -> None:
|
||||||
|
_providers[_channel_key(provider.channel)] = provider
|
||||||
|
|
||||||
|
|
||||||
|
def get_provider(channel: str) -> DeliveryProvider | None:
|
||||||
|
return _providers.get(_channel_key(channel))
|
||||||
|
|
||||||
|
|
||||||
|
def get_provider_or_raise(channel: str) -> DeliveryProvider:
|
||||||
|
provider = get_provider(channel)
|
||||||
|
if provider is None:
|
||||||
|
raise KeyError(f'No delivery provider registered for channel: {channel}')
|
||||||
|
return provider
|
||||||
|
|
||||||
|
|
||||||
|
def registered_channels() -> Iterable[str]:
|
||||||
|
return _providers.keys()
|
||||||
|
|
@ -0,0 +1,236 @@
|
||||||
|
# Generated by Django 5.0.6 on 2026-10-09 01:15
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
import notify.models
|
||||||
|
import uuid
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='DeliveryConfig',
|
||||||
|
fields=[
|
||||||
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||||
|
('name', models.CharField(max_length=255, unique=True)),
|
||||||
|
('channel', models.CharField(choices=[('email', 'Email'), ('telegram', 'Telegram'), ('browser', 'Browser'), ('max', 'Max')], max_length=20)),
|
||||||
|
('is_default', models.BooleanField(default=False)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Notification',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(primary_key=True, serialize=False)),
|
||||||
|
('url', models.TextField(null=True)),
|
||||||
|
('level', models.CharField(choices=[('SUCCESS', 'Success'), ('INFO', 'Info'), ('WARNING', 'Warning'), ('ERROR', 'Error')], default='INFO', max_length=20)),
|
||||||
|
('verb', models.CharField(max_length=255)),
|
||||||
|
('object_id', models.CharField(default='', max_length=255)),
|
||||||
|
('description', models.TextField(blank=True, null=True)),
|
||||||
|
('data', models.JSONField(blank=True, default=dict)),
|
||||||
|
('idempotency_key', models.CharField(blank=True, max_length=255, null=True, unique=True)),
|
||||||
|
('expires_at', models.DateTimeField(db_index=True, default=notify.models.default_expires_at)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'ordering': ('-created_at',),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='NotificationAttachment',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(primary_key=True, serialize=False)),
|
||||||
|
('file', models.FileField(upload_to='notify/attachments/%Y/%m/%d')),
|
||||||
|
('name', models.CharField(max_length=255)),
|
||||||
|
('content_type', models.CharField(default='application/octet-stream', max_length=255)),
|
||||||
|
('size', models.PositiveIntegerField()),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'ordering': ('created_at', 'id'),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='NotificationChannelPreference',
|
||||||
|
fields=[
|
||||||
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||||
|
('channel', models.CharField(choices=[('email', 'Email'), ('telegram', 'Telegram'), ('browser', 'Browser'), ('max', 'Max')], max_length=20)),
|
||||||
|
('enabled', models.BooleanField(default=True)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='NotificationGroup',
|
||||||
|
fields=[
|
||||||
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||||
|
('code', models.CharField(max_length=100, unique=True)),
|
||||||
|
('name', models.CharField(max_length=100)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'ordering': ('code',),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='NotificationRecipient',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(primary_key=True, serialize=False)),
|
||||||
|
('delivery_channel', models.CharField(choices=[('email', 'Email'), ('telegram', 'Telegram'), ('browser', 'Browser'), ('max', 'Max')], max_length=20)),
|
||||||
|
('delivery_address', models.CharField(blank=True, max_length=255, null=True)),
|
||||||
|
('delivery_data', models.JSONField(blank=True, default=None, null=True)),
|
||||||
|
('delivery_status', models.CharField(choices=[('UNSENT', 'Unsent'), ('SENT', 'Sent'), ('FAILED', 'Failed')], default='UNSENT', max_length=10)),
|
||||||
|
('sent_at', models.DateTimeField(blank=True, null=True)),
|
||||||
|
('attempts', models.PositiveSmallIntegerField(default=0)),
|
||||||
|
('last_error', models.TextField(blank=True, default='')),
|
||||||
|
('unread', models.BooleanField(db_index=True, default=True)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='NotificationTemplate',
|
||||||
|
fields=[
|
||||||
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||||
|
('channel', models.CharField(choices=[('email', 'Email'), ('telegram', 'Telegram'), ('browser', 'Browser'), ('max', 'Max')], max_length=20)),
|
||||||
|
('name', models.CharField(max_length=255, unique=True)),
|
||||||
|
('is_default', models.BooleanField(default=False)),
|
||||||
|
('subject_template', models.TextField(blank=True, default='')),
|
||||||
|
('body_template', models.TextField()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='NotificationType',
|
||||||
|
fields=[
|
||||||
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||||
|
('code', models.CharField(max_length=100, unique=True)),
|
||||||
|
('name', models.CharField(max_length=100)),
|
||||||
|
('channels', models.JSONField(blank=True, default=list, validators=[notify.models.validate_delivery_channels])),
|
||||||
|
('verb', models.CharField(blank=True, max_length=255, null=True)),
|
||||||
|
('position', models.IntegerField(default=0)),
|
||||||
|
('is_active', models.BooleanField(default=True)),
|
||||||
|
('can_switch', models.BooleanField(default=True)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'ordering': ('position', 'code'),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='VerificationCode',
|
||||||
|
fields=[
|
||||||
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||||
|
('purpose', models.CharField(max_length=100)),
|
||||||
|
('channel', models.CharField(choices=[('email', 'Email'), ('telegram', 'Telegram'), ('browser', 'Browser'), ('max', 'Max')], max_length=20)),
|
||||||
|
('target', models.CharField(max_length=255)),
|
||||||
|
('delivery_data', models.JSONField(blank=True, default=None, null=True)),
|
||||||
|
('code_hash', models.CharField(max_length=128)),
|
||||||
|
('expires_at', models.DateTimeField(db_index=True)),
|
||||||
|
('attempts', models.PositiveSmallIntegerField(default=0)),
|
||||||
|
('max_attempts', models.PositiveSmallIntegerField()),
|
||||||
|
('consumed_at', models.DateTimeField(blank=True, null=True)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'ordering': ('-created_at',),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='DeliveryEmailConfig',
|
||||||
|
fields=[
|
||||||
|
('deliveryconfig_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='notify.deliveryconfig')),
|
||||||
|
('host', models.CharField(max_length=100)),
|
||||||
|
('port', models.IntegerField(default=587)),
|
||||||
|
('username', models.CharField(blank=True, default='', max_length=100)),
|
||||||
|
('password', models.CharField(blank=True, default='', max_length=100)),
|
||||||
|
('from_email', models.CharField(blank=True, default='', max_length=100)),
|
||||||
|
('test_email', models.EmailField(blank=True, default='', max_length=100)),
|
||||||
|
('use_ssl', models.BooleanField(default=False)),
|
||||||
|
('use_tls', models.BooleanField(default=True)),
|
||||||
|
],
|
||||||
|
bases=('notify.deliveryconfig',),
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='DeliveryTokenConfig',
|
||||||
|
fields=[
|
||||||
|
('deliveryconfig_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='notify.deliveryconfig')),
|
||||||
|
('token', models.CharField(blank=True, max_length=500)),
|
||||||
|
],
|
||||||
|
bases=('notify.deliveryconfig',),
|
||||||
|
),
|
||||||
|
migrations.AddConstraint(
|
||||||
|
model_name='deliveryconfig',
|
||||||
|
constraint=models.UniqueConstraint(condition=models.Q(('is_default', True)), fields=('channel',), name='uniq_default_delivery_cfg'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='notificationattachment',
|
||||||
|
name='notification',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='attachments', to='notify.notification'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='notificationchannelpreference',
|
||||||
|
name='user',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_channel_preferences', to=settings.AUTH_USER_MODEL),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='notificationrecipient',
|
||||||
|
name='notification',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='recipients', to='notify.notification'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='notificationrecipient',
|
||||||
|
name='user',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_recipients', to=settings.AUTH_USER_MODEL),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='notificationtype',
|
||||||
|
name='group',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='types', to='notify.notificationgroup'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='notificationtemplate',
|
||||||
|
name='type',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='templates', to='notify.notificationtype'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='notificationchannelpreference',
|
||||||
|
name='type',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='channel_preferences', to='notify.notificationtype'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='notification',
|
||||||
|
name='type',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='notifications', to='notify.notificationtype'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='verificationcode',
|
||||||
|
name='user',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='verification_codes', to=settings.AUTH_USER_MODEL),
|
||||||
|
),
|
||||||
|
migrations.AddIndex(
|
||||||
|
model_name='notificationrecipient',
|
||||||
|
index=models.Index(fields=['user', 'delivery_channel', 'created_at'], name='idx_recipient_inbox'),
|
||||||
|
),
|
||||||
|
migrations.AddConstraint(
|
||||||
|
model_name='notificationrecipient',
|
||||||
|
constraint=models.UniqueConstraint(fields=('notification', 'user', 'delivery_channel'), name='uniq_recipient_channel'),
|
||||||
|
),
|
||||||
|
migrations.AddConstraint(
|
||||||
|
model_name='notificationtemplate',
|
||||||
|
constraint=models.UniqueConstraint(condition=models.Q(('is_default', True), ('type__isnull', True)), fields=('channel',), name='uniq_default_template_channel'),
|
||||||
|
),
|
||||||
|
migrations.AddConstraint(
|
||||||
|
model_name='notificationtemplate',
|
||||||
|
constraint=models.UniqueConstraint(condition=models.Q(('type__isnull', False)), fields=('type', 'channel'), name='uniq_template_type_channel'),
|
||||||
|
),
|
||||||
|
migrations.AddConstraint(
|
||||||
|
model_name='notificationchannelpreference',
|
||||||
|
constraint=models.UniqueConstraint(fields=('user', 'type', 'channel'), name='uniq_user_type_channel_pref'),
|
||||||
|
),
|
||||||
|
migrations.AddIndex(
|
||||||
|
model_name='verificationcode',
|
||||||
|
index=models.Index(fields=['purpose', 'channel', 'target', 'created_at'], name='idx_code_lookup'),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
def forwards(apps, schema_editor):
|
||||||
|
NotificationRecipient = apps.get_model("notify", "NotificationRecipient")
|
||||||
|
for recipient in NotificationRecipient.objects.all().iterator():
|
||||||
|
if recipient.delivery_channel == "email":
|
||||||
|
target = {"email": recipient.delivery_address} if recipient.delivery_address else None
|
||||||
|
else:
|
||||||
|
target = recipient.delivery_data
|
||||||
|
if target is not None:
|
||||||
|
recipient.delivery_target = target
|
||||||
|
recipient.save(update_fields=["delivery_target"])
|
||||||
|
|
||||||
|
|
||||||
|
def backwards(apps, schema_editor):
|
||||||
|
NotificationRecipient = apps.get_model("notify", "NotificationRecipient")
|
||||||
|
for recipient in NotificationRecipient.objects.exclude(delivery_target=None).iterator():
|
||||||
|
if recipient.delivery_channel == "email":
|
||||||
|
recipient.delivery_address = recipient.delivery_target.get("email")
|
||||||
|
else:
|
||||||
|
recipient.delivery_data = recipient.delivery_target
|
||||||
|
recipient.save(update_fields=["delivery_address", "delivery_data"])
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("notify", "0001_initial"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="notificationrecipient",
|
||||||
|
name="delivery_target",
|
||||||
|
field=models.JSONField(blank=True, default=None, null=True),
|
||||||
|
),
|
||||||
|
migrations.RunPython(forwards, backwards),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name="notificationrecipient",
|
||||||
|
name="delivery_address",
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name="notificationrecipient",
|
||||||
|
name="delivery_data",
|
||||||
|
),
|
||||||
|
migrations.RemoveIndex(
|
||||||
|
model_name="verificationcode",
|
||||||
|
name="idx_code_lookup",
|
||||||
|
),
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name="verificationcode",
|
||||||
|
old_name="target",
|
||||||
|
new_name="target_key",
|
||||||
|
),
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name="verificationcode",
|
||||||
|
old_name="delivery_data",
|
||||||
|
new_name="delivery_target",
|
||||||
|
),
|
||||||
|
migrations.AddIndex(
|
||||||
|
model_name="verificationcode",
|
||||||
|
index=models.Index(fields=["purpose", "channel", "target_key", "created_at"], name="idx_code_lookup"),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
from notify.models.choices import (
|
||||||
|
DeliveryChannel,
|
||||||
|
DeliveryStatus,
|
||||||
|
NotificationLevel,
|
||||||
|
validate_delivery_channels,
|
||||||
|
)
|
||||||
|
from notify.models.code import VerificationCode
|
||||||
|
from notify.models.delivery import (
|
||||||
|
DeliveryConfig,
|
||||||
|
DeliveryEmailConfig,
|
||||||
|
DeliveryTokenConfig,
|
||||||
|
)
|
||||||
|
from notify.models.group import NotificationGroup
|
||||||
|
from notify.models.managers import NotificationGroupManager, NotificationTypeManager
|
||||||
|
from notify.models.notification import (
|
||||||
|
Notification,
|
||||||
|
NotificationAttachment,
|
||||||
|
NotificationRecipient,
|
||||||
|
default_expires_at,
|
||||||
|
)
|
||||||
|
from notify.models.notification_type import NotificationChannelPreference, NotificationType
|
||||||
|
from notify.models.template import NotificationTemplate
|
||||||
|
|
||||||
|
default_expires_at.__module__ = "notify.models"
|
||||||
|
validate_delivery_channels.__module__ = "notify.models"
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"DeliveryChannel",
|
||||||
|
"DeliveryStatus",
|
||||||
|
"NotificationLevel",
|
||||||
|
"default_expires_at",
|
||||||
|
"validate_delivery_channels",
|
||||||
|
"NotificationGroupManager",
|
||||||
|
"NotificationTypeManager",
|
||||||
|
"NotificationGroup",
|
||||||
|
"NotificationType",
|
||||||
|
"DeliveryConfig",
|
||||||
|
"DeliveryEmailConfig",
|
||||||
|
"DeliveryTokenConfig",
|
||||||
|
"NotificationTemplate",
|
||||||
|
"NotificationChannelPreference",
|
||||||
|
"Notification",
|
||||||
|
"NotificationAttachment",
|
||||||
|
"NotificationRecipient",
|
||||||
|
"VerificationCode",
|
||||||
|
]
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
from django.core.exceptions import ValidationError
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"DeliveryChannel",
|
||||||
|
"DeliveryStatus",
|
||||||
|
"NotificationLevel",
|
||||||
|
"validate_delivery_channels",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class DeliveryChannel(models.TextChoices):
|
||||||
|
EMAIL = "email"
|
||||||
|
TELEGRAM = "telegram"
|
||||||
|
BROWSER = "browser"
|
||||||
|
MAX = "max"
|
||||||
|
|
||||||
|
|
||||||
|
class DeliveryStatus(models.TextChoices):
|
||||||
|
UNSENT = "UNSENT"
|
||||||
|
SENT = "SENT"
|
||||||
|
FAILED = "FAILED"
|
||||||
|
|
||||||
|
|
||||||
|
class NotificationLevel(models.TextChoices):
|
||||||
|
SUCCESS = "SUCCESS"
|
||||||
|
INFO = "INFO"
|
||||||
|
WARNING = "WARNING"
|
||||||
|
ERROR = "ERROR"
|
||||||
|
|
||||||
|
|
||||||
|
def validate_delivery_channels(value):
|
||||||
|
if not isinstance(value, list):
|
||||||
|
raise ValidationError("channels must be a list")
|
||||||
|
allowed = set(DeliveryChannel.values)
|
||||||
|
unknown = [item for item in value if item not in allowed]
|
||||||
|
if unknown:
|
||||||
|
raise ValidationError(f"Unknown channels: {', '.join(map(str, unknown))}")
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import models
|
||||||
|
from django.utils import timezone
|
||||||
|
from django.utils.crypto import constant_time_compare, salted_hmac
|
||||||
|
|
||||||
|
from notify.models.choices import DeliveryChannel
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"VerificationCode",
|
||||||
|
]
|
||||||
|
|
||||||
|
CODE_HASH_SALT = "notify.code"
|
||||||
|
|
||||||
|
|
||||||
|
class VerificationCode(models.Model):
|
||||||
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||||
|
user = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL,
|
||||||
|
null=True,
|
||||||
|
blank=True,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name="verification_codes",
|
||||||
|
)
|
||||||
|
purpose = models.CharField(max_length=100)
|
||||||
|
channel = models.CharField(max_length=20, choices=DeliveryChannel)
|
||||||
|
target_key = models.CharField(max_length=255)
|
||||||
|
delivery_target = models.JSONField(null=True, blank=True, default=None)
|
||||||
|
code_hash = models.CharField(max_length=128)
|
||||||
|
expires_at = models.DateTimeField(db_index=True)
|
||||||
|
attempts = models.PositiveSmallIntegerField(default=0)
|
||||||
|
max_attempts = models.PositiveSmallIntegerField()
|
||||||
|
consumed_at = models.DateTimeField(null=True, blank=True)
|
||||||
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ("-created_at",)
|
||||||
|
indexes = [
|
||||||
|
models.Index(fields=["purpose", "channel", "target_key", "created_at"], name="idx_code_lookup"),
|
||||||
|
]
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.purpose} via {self.channel} to {self.target_key}"
|
||||||
|
|
||||||
|
def _hash(self, code: str) -> str:
|
||||||
|
return salted_hmac(CODE_HASH_SALT, f"{self.id}:{code}", algorithm="sha256").hexdigest()
|
||||||
|
|
||||||
|
def set_code(self, code: str) -> None:
|
||||||
|
self.code_hash = self._hash(code)
|
||||||
|
|
||||||
|
def check_code(self, code: str) -> bool:
|
||||||
|
return constant_time_compare(self.code_hash, self._hash(code))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_expired(self) -> bool:
|
||||||
|
return self.expires_at <= timezone.now()
|
||||||
|
|
@ -0,0 +1,92 @@
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
from django.core.exceptions import ValidationError
|
||||||
|
from django.db import models, transaction
|
||||||
|
|
||||||
|
from notify.models.choices import DeliveryChannel
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"EMAIL_TIMEOUT",
|
||||||
|
"DeliveryConfig",
|
||||||
|
"DeliveryEmailConfig",
|
||||||
|
"DeliveryTokenConfig",
|
||||||
|
]
|
||||||
|
|
||||||
|
EMAIL_TIMEOUT = 10
|
||||||
|
|
||||||
|
|
||||||
|
class DeliveryConfig(models.Model):
|
||||||
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||||
|
name = models.CharField(unique=True, max_length=255)
|
||||||
|
channel = models.CharField(max_length=20, choices=DeliveryChannel)
|
||||||
|
is_default = models.BooleanField(default=False)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
constraints = [
|
||||||
|
models.UniqueConstraint(
|
||||||
|
fields=["channel"],
|
||||||
|
condition=models.Q(is_default=True),
|
||||||
|
name="uniq_default_delivery_cfg",
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
update_fields = kwargs.get("update_fields")
|
||||||
|
touches_default = update_fields is None or "is_default" in update_fields
|
||||||
|
with transaction.atomic():
|
||||||
|
if self.is_default and touches_default:
|
||||||
|
others = type(self).objects.filter(channel=self.channel, is_default=True)
|
||||||
|
if self.pk:
|
||||||
|
others = others.exclude(pk=self.pk)
|
||||||
|
others.update(is_default=False)
|
||||||
|
super().save(*args, **kwargs)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_default(cls):
|
||||||
|
return cls.objects.filter(is_default=True).order_by("id").first()
|
||||||
|
|
||||||
|
|
||||||
|
class DeliveryEmailConfig(DeliveryConfig):
|
||||||
|
host = models.CharField(max_length=100)
|
||||||
|
port = models.IntegerField(default=587)
|
||||||
|
username = models.CharField(max_length=100, default="", blank=True)
|
||||||
|
password = models.CharField(max_length=100, default="", blank=True)
|
||||||
|
from_email = models.CharField(max_length=100, default="", blank=True)
|
||||||
|
test_email = models.EmailField(max_length=100, default="", blank=True)
|
||||||
|
use_ssl = models.BooleanField(default=False)
|
||||||
|
use_tls = models.BooleanField(default=True)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.username} ({self.host})"
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
super().clean()
|
||||||
|
if self.use_ssl and self.use_tls:
|
||||||
|
raise ValidationError("use_ssl and use_tls cannot both be enabled")
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
if self.use_ssl and self.use_tls:
|
||||||
|
raise ValidationError("use_ssl and use_tls cannot both be enabled")
|
||||||
|
super().save(*args, **kwargs)
|
||||||
|
|
||||||
|
def get_connection_config(self):
|
||||||
|
return dict(
|
||||||
|
host=self.host,
|
||||||
|
port=self.port,
|
||||||
|
username=self.username,
|
||||||
|
password=self.password,
|
||||||
|
use_ssl=self.use_ssl,
|
||||||
|
use_tls=self.use_tls,
|
||||||
|
timeout=EMAIL_TIMEOUT,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class DeliveryTokenConfig(DeliveryConfig):
|
||||||
|
token = models.CharField(max_length=500, blank=True)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_default(cls, channel):
|
||||||
|
return cls.objects.filter(channel=channel, is_default=True).order_by("id").first()
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
from notify.models.managers import NotificationGroupManager
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"NotificationGroup",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class NotificationGroup(models.Model):
|
||||||
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||||
|
code = models.CharField(max_length=100, unique=True)
|
||||||
|
name = models.CharField(max_length=100)
|
||||||
|
|
||||||
|
objects = NotificationGroupManager()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ("code",)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
def natural_key(self):
|
||||||
|
return (self.code,)
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"NotificationGroupManager",
|
||||||
|
"NotificationTypeManager",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class NotificationGroupManager(models.Manager):
|
||||||
|
def get_by_natural_key(self, code):
|
||||||
|
return self.get(code=code)
|
||||||
|
|
||||||
|
|
||||||
|
class NotificationTypeManager(models.Manager):
|
||||||
|
def get_by_natural_key(self, code):
|
||||||
|
return self.get(code=code)
|
||||||
|
|
@ -0,0 +1,120 @@
|
||||||
|
from datetime import timedelta
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import models
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
|
from notify.models.choices import DeliveryChannel, DeliveryStatus, NotificationLevel
|
||||||
|
from notify.models.notification_type import NotificationType
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"default_expires_at",
|
||||||
|
"Notification",
|
||||||
|
"NotificationAttachment",
|
||||||
|
"NotificationRecipient",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def default_expires_at():
|
||||||
|
return timezone.now() + timedelta(days=30)
|
||||||
|
|
||||||
|
|
||||||
|
class Notification(models.Model):
|
||||||
|
id = models.BigAutoField(primary_key=True)
|
||||||
|
url = models.TextField(null=True)
|
||||||
|
type = models.ForeignKey(
|
||||||
|
NotificationType,
|
||||||
|
null=True,
|
||||||
|
blank=True,
|
||||||
|
on_delete=models.SET_NULL,
|
||||||
|
related_name="notifications",
|
||||||
|
)
|
||||||
|
level = models.CharField(max_length=20, choices=NotificationLevel, default=NotificationLevel.INFO)
|
||||||
|
verb = models.CharField(max_length=255)
|
||||||
|
object_id = models.CharField(max_length=255, default="")
|
||||||
|
description = models.TextField(blank=True, null=True)
|
||||||
|
data = models.JSONField(blank=True, default=dict)
|
||||||
|
idempotency_key = models.CharField(max_length=255, null=True, blank=True, unique=True)
|
||||||
|
expires_at = models.DateTimeField(default=default_expires_at, db_index=True)
|
||||||
|
created_at = models.DateTimeField(db_index=True, auto_now_add=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ("-created_at",)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.verb
|
||||||
|
|
||||||
|
@property
|
||||||
|
def relative_url(self):
|
||||||
|
if self.url:
|
||||||
|
parsed = urlparse(self.url)
|
||||||
|
return parsed.path
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
class NotificationAttachment(models.Model):
|
||||||
|
id = models.BigAutoField(primary_key=True)
|
||||||
|
notification = models.ForeignKey(Notification, on_delete=models.CASCADE, related_name="attachments")
|
||||||
|
file = models.FileField(upload_to="notify/attachments/%Y/%m/%d")
|
||||||
|
name = models.CharField(max_length=255)
|
||||||
|
content_type = models.CharField(max_length=255, default="application/octet-stream")
|
||||||
|
size = models.PositiveIntegerField()
|
||||||
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ("created_at", "id")
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
|
||||||
|
class NotificationRecipient(models.Model):
|
||||||
|
id = models.BigAutoField(primary_key=True)
|
||||||
|
notification = models.ForeignKey(Notification, on_delete=models.CASCADE, related_name="recipients")
|
||||||
|
user = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name="notification_recipients",
|
||||||
|
)
|
||||||
|
delivery_channel = models.CharField(max_length=20, choices=DeliveryChannel)
|
||||||
|
delivery_target = models.JSONField(null=True, blank=True, default=None)
|
||||||
|
delivery_status = models.CharField(max_length=10, choices=DeliveryStatus, default=DeliveryStatus.UNSENT)
|
||||||
|
sent_at = models.DateTimeField(null=True, blank=True)
|
||||||
|
attempts = models.PositiveSmallIntegerField(default=0)
|
||||||
|
last_error = models.TextField(blank=True, default="")
|
||||||
|
unread = models.BooleanField(default=True, db_index=True)
|
||||||
|
created_at = models.DateTimeField(db_index=True, auto_now_add=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
constraints = [
|
||||||
|
models.UniqueConstraint(
|
||||||
|
fields=["notification", "user", "delivery_channel"],
|
||||||
|
name="uniq_recipient_channel",
|
||||||
|
),
|
||||||
|
]
|
||||||
|
indexes = [
|
||||||
|
models.Index(fields=["user", "delivery_channel", "created_at"], name="idx_recipient_inbox"),
|
||||||
|
]
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
target = self.delivery_target
|
||||||
|
if isinstance(target, dict) and target.get("email"):
|
||||||
|
target = target["email"]
|
||||||
|
target_info = f" to {target}" if target else ""
|
||||||
|
return f"{self.delivery_channel}{target_info} ({self.delivery_status})"
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
if self.delivery_channel == DeliveryChannel.BROWSER:
|
||||||
|
self.delivery_status = DeliveryStatus.SENT
|
||||||
|
if self.sent_at is None:
|
||||||
|
self.sent_at = timezone.now()
|
||||||
|
super().save(*args, **kwargs)
|
||||||
|
|
||||||
|
def make_read(self):
|
||||||
|
self.unread = False
|
||||||
|
self.save(update_fields=["unread"])
|
||||||
|
|
||||||
|
def make_unread(self):
|
||||||
|
self.unread = True
|
||||||
|
self.save(update_fields=["unread"])
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
from notify.models.choices import DeliveryChannel, validate_delivery_channels
|
||||||
|
from notify.models.group import NotificationGroup
|
||||||
|
from notify.models.managers import NotificationTypeManager
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"NotificationType",
|
||||||
|
"NotificationChannelPreference",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class NotificationType(models.Model):
|
||||||
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||||
|
code = models.CharField(max_length=100, unique=True)
|
||||||
|
name = models.CharField(max_length=100)
|
||||||
|
channels = models.JSONField(default=list, blank=True, validators=[validate_delivery_channels])
|
||||||
|
group = models.ForeignKey(NotificationGroup, on_delete=models.PROTECT, related_name="types")
|
||||||
|
verb = models.CharField(max_length=255, null=True, blank=True)
|
||||||
|
position = models.IntegerField(default=0)
|
||||||
|
is_active = models.BooleanField(default=True)
|
||||||
|
can_switch = models.BooleanField(default=True)
|
||||||
|
|
||||||
|
objects = NotificationTypeManager()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ("position", "code")
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
def natural_key(self):
|
||||||
|
return (self.code,)
|
||||||
|
|
||||||
|
|
||||||
|
class NotificationChannelPreference(models.Model):
|
||||||
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||||
|
user = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name="notification_channel_preferences",
|
||||||
|
)
|
||||||
|
type = models.ForeignKey(
|
||||||
|
NotificationType,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name="channel_preferences",
|
||||||
|
)
|
||||||
|
channel = models.CharField(max_length=20, choices=DeliveryChannel)
|
||||||
|
enabled = models.BooleanField(default=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
constraints = [
|
||||||
|
models.UniqueConstraint(
|
||||||
|
fields=["user", "type", "channel"],
|
||||||
|
name="uniq_user_type_channel_pref",
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
state = "on" if self.enabled else "off"
|
||||||
|
return f"{self.user_id} {self.channel} {state}"
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
from django.db import models, transaction
|
||||||
|
|
||||||
|
from notify.models.choices import DeliveryChannel
|
||||||
|
from notify.rendering import render
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"NotificationTemplate",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class NotificationTemplate(models.Model):
|
||||||
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||||
|
channel = models.CharField(max_length=20, choices=DeliveryChannel)
|
||||||
|
type = models.ForeignKey(
|
||||||
|
"notify.NotificationType",
|
||||||
|
null=True,
|
||||||
|
blank=True,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name="templates",
|
||||||
|
)
|
||||||
|
name = models.CharField(unique=True, max_length=255)
|
||||||
|
is_default = models.BooleanField(default=False)
|
||||||
|
subject_template = models.TextField(default="", blank=True)
|
||||||
|
body_template = models.TextField()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
constraints = [
|
||||||
|
models.UniqueConstraint(
|
||||||
|
fields=["channel"],
|
||||||
|
condition=models.Q(is_default=True, type__isnull=True),
|
||||||
|
name="uniq_default_template_channel",
|
||||||
|
),
|
||||||
|
models.UniqueConstraint(
|
||||||
|
fields=["type", "channel"],
|
||||||
|
condition=models.Q(type__isnull=False),
|
||||||
|
name="uniq_template_type_channel",
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
update_fields = kwargs.get("update_fields")
|
||||||
|
touches_default = update_fields is None or "is_default" in update_fields
|
||||||
|
with transaction.atomic():
|
||||||
|
if self.is_default and touches_default and self.type_id is None:
|
||||||
|
others = type(self).objects.filter(
|
||||||
|
channel=self.channel,
|
||||||
|
type__isnull=True,
|
||||||
|
is_default=True,
|
||||||
|
)
|
||||||
|
if self.pk:
|
||||||
|
others = others.exclude(pk=self.pk)
|
||||||
|
others.update(is_default=False)
|
||||||
|
super().save(*args, **kwargs)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def default(cls, channel):
|
||||||
|
return (
|
||||||
|
cls.objects.filter(channel=channel, type__isnull=True, is_default=True)
|
||||||
|
.order_by("id")
|
||||||
|
.first()
|
||||||
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def for_delivery(cls, channel, notification_type):
|
||||||
|
if notification_type is not None:
|
||||||
|
typed = cls.objects.filter(channel=channel, type=notification_type).order_by("id").first()
|
||||||
|
if typed is not None:
|
||||||
|
return typed
|
||||||
|
return cls.default(channel)
|
||||||
|
|
||||||
|
def render_subject(self, context):
|
||||||
|
return render(self.subject_template, context)
|
||||||
|
|
||||||
|
def render_body(self, context):
|
||||||
|
return render(self.body_template, context)
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
from django.db import transaction
|
||||||
|
from django.db.models.signals import post_delete, post_save
|
||||||
|
from django.dispatch import receiver
|
||||||
|
|
||||||
|
from notify.delivery import get_provider
|
||||||
|
from notify.models import NotificationAttachment, NotificationRecipient
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"delete_attachment_file",
|
||||||
|
"post_save_notification",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@receiver(post_save, sender=NotificationRecipient)
|
||||||
|
def post_save_notification(sender, instance: NotificationRecipient, created, **kwargs):
|
||||||
|
if not created:
|
||||||
|
return
|
||||||
|
provider = get_provider(instance.delivery_channel)
|
||||||
|
if provider is None or not provider.requires_async_delivery:
|
||||||
|
return
|
||||||
|
recipient_id = instance.id
|
||||||
|
|
||||||
|
def enqueue():
|
||||||
|
current = get_provider(instance.delivery_channel)
|
||||||
|
if current is not None:
|
||||||
|
current.enqueue(recipient_id)
|
||||||
|
|
||||||
|
transaction.on_commit(enqueue)
|
||||||
|
|
||||||
|
|
||||||
|
@receiver(post_delete, sender=NotificationAttachment)
|
||||||
|
def delete_attachment_file(sender, instance: NotificationAttachment, **kwargs):
|
||||||
|
if instance.file:
|
||||||
|
instance.file.delete(save=False)
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
import markdown as md
|
||||||
|
from django.utils.html import escape
|
||||||
|
from jinja2 import ChainableUndefined, Environment
|
||||||
|
from markupsafe import Markup
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"render",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def markdown(value):
|
||||||
|
if value is None:
|
||||||
|
value = ""
|
||||||
|
html_output = md.markdown(
|
||||||
|
escape(str(value)),
|
||||||
|
extensions=["markdown.extensions.fenced_code"],
|
||||||
|
)
|
||||||
|
return Markup(html_output)
|
||||||
|
|
||||||
|
|
||||||
|
_env = Environment(autoescape=True, undefined=ChainableUndefined)
|
||||||
|
_env.filters["markdown"] = markdown
|
||||||
|
|
||||||
|
|
||||||
|
def render(source, context):
|
||||||
|
return _env.from_string(source or "").render(context)
|
||||||
|
|
@ -0,0 +1,255 @@
|
||||||
|
from django.db import IntegrityError, transaction
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
|
from notify.attachments import discard_attachments, prepare_attachments, store_attachments
|
||||||
|
from notify.delivery import get_provider
|
||||||
|
from notify.models import (
|
||||||
|
DeliveryChannel,
|
||||||
|
Notification,
|
||||||
|
NotificationChannelPreference,
|
||||||
|
NotificationLevel,
|
||||||
|
NotificationRecipient,
|
||||||
|
NotificationType,
|
||||||
|
)
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"create_notification",
|
||||||
|
"channel_preferences",
|
||||||
|
"save_channel_preferences",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def _resolve_type(notification_type):
|
||||||
|
if notification_type is None:
|
||||||
|
return None
|
||||||
|
if isinstance(notification_type, NotificationType):
|
||||||
|
return notification_type
|
||||||
|
return NotificationType.objects.get(code=notification_type)
|
||||||
|
|
||||||
|
|
||||||
|
def _existing_idempotent(idempotency_key):
|
||||||
|
if not idempotency_key:
|
||||||
|
return None
|
||||||
|
return Notification.objects.filter(idempotency_key=idempotency_key).first()
|
||||||
|
|
||||||
|
|
||||||
|
def _allowed_channels(notification_type, user, channels):
|
||||||
|
if notification_type is None or not notification_type.can_switch:
|
||||||
|
return channels
|
||||||
|
allowed = set(notification_type.channels)
|
||||||
|
prefs = {
|
||||||
|
pref.channel: pref.enabled
|
||||||
|
for pref in NotificationChannelPreference.objects.filter(
|
||||||
|
user=user,
|
||||||
|
type=notification_type,
|
||||||
|
channel__in=allowed,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
kept = []
|
||||||
|
for channel_data in channels:
|
||||||
|
channel = channel_data["channel"]
|
||||||
|
if channel not in allowed:
|
||||||
|
raise ValueError(
|
||||||
|
f"Channel {channel} is not allowed for notification type {notification_type.code}"
|
||||||
|
)
|
||||||
|
if prefs.get(channel, True):
|
||||||
|
kept.append(channel_data)
|
||||||
|
return kept
|
||||||
|
|
||||||
|
|
||||||
|
def _grouped_notification(notification_type, user, object_id):
|
||||||
|
if notification_type is None or not object_id:
|
||||||
|
return None
|
||||||
|
return (
|
||||||
|
Notification.objects.select_for_update()
|
||||||
|
.filter(
|
||||||
|
type=notification_type,
|
||||||
|
object_id=object_id,
|
||||||
|
expires_at__gte=timezone.now(),
|
||||||
|
recipients__user=user,
|
||||||
|
recipients__delivery_channel=DeliveryChannel.BROWSER,
|
||||||
|
recipients__unread=True,
|
||||||
|
)
|
||||||
|
.order_by("-created_at")
|
||||||
|
.first()
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _bump_group(notification, verb):
|
||||||
|
payload = dict(notification.data or {})
|
||||||
|
payload["count"] = int(payload.get("count", 1)) + 1
|
||||||
|
notification.data = payload
|
||||||
|
if verb:
|
||||||
|
notification.verb = verb
|
||||||
|
notification.save(update_fields=["data", "verb"])
|
||||||
|
return notification
|
||||||
|
|
||||||
|
|
||||||
|
def _collapse_grouped(notification_type, recipients, object_id, verb):
|
||||||
|
pending = []
|
||||||
|
grouped = []
|
||||||
|
seen = set()
|
||||||
|
for recipient_data in recipients:
|
||||||
|
found = _grouped_notification(notification_type, recipient_data["user"], object_id)
|
||||||
|
if found is None:
|
||||||
|
pending.append(recipient_data)
|
||||||
|
continue
|
||||||
|
if found.pk not in seen:
|
||||||
|
seen.add(found.pk)
|
||||||
|
grouped.append(found)
|
||||||
|
for notification in grouped:
|
||||||
|
_bump_group(notification, verb)
|
||||||
|
return pending, grouped
|
||||||
|
|
||||||
|
|
||||||
|
def _attach_recipients(notification, recipients, notification_type):
|
||||||
|
created = 0
|
||||||
|
seen = set()
|
||||||
|
allowed_channels = set(notification_type.channels) if notification_type is not None else None
|
||||||
|
for recipient_data in recipients:
|
||||||
|
channels = recipient_data.get("channels") or []
|
||||||
|
if not channels:
|
||||||
|
raise ValueError("Recipient has no channels")
|
||||||
|
user = recipient_data["user"]
|
||||||
|
channels = _allowed_channels(notification_type, user, channels)
|
||||||
|
for channel_data in channels:
|
||||||
|
channel = channel_data["channel"]
|
||||||
|
if allowed_channels is not None and channel not in allowed_channels:
|
||||||
|
raise ValueError(
|
||||||
|
f"Channel {channel} is not allowed for notification type {notification_type.code}"
|
||||||
|
)
|
||||||
|
identity = (user.pk, channel)
|
||||||
|
if identity in seen:
|
||||||
|
raise ValueError(f"Duplicate recipient for user {user.pk} and channel {channel}")
|
||||||
|
seen.add(identity)
|
||||||
|
provider = get_provider(channel)
|
||||||
|
if provider is None:
|
||||||
|
raise ValueError(f"No delivery provider registered for channel: {channel}")
|
||||||
|
target = provider.validate_target(channel_data.get("target"))
|
||||||
|
NotificationRecipient.objects.create(
|
||||||
|
notification=notification,
|
||||||
|
user=user,
|
||||||
|
delivery_channel=channel,
|
||||||
|
delivery_target=target.model_dump() if target is not None else None,
|
||||||
|
)
|
||||||
|
created += 1
|
||||||
|
if created == 0:
|
||||||
|
raise ValueError("No recipients to deliver")
|
||||||
|
return created
|
||||||
|
|
||||||
|
|
||||||
|
def create_notification(
|
||||||
|
*,
|
||||||
|
recipients: list[dict],
|
||||||
|
verb: str | None = None,
|
||||||
|
url: str | None = None,
|
||||||
|
type: NotificationType | str | None = None,
|
||||||
|
level: str = NotificationLevel.INFO,
|
||||||
|
object_id: str = "",
|
||||||
|
description: str | None = None,
|
||||||
|
data: dict | None = None,
|
||||||
|
expires_at=None,
|
||||||
|
idempotency_key: str | None = None,
|
||||||
|
group: bool = False,
|
||||||
|
attachments=None,
|
||||||
|
) -> Notification:
|
||||||
|
if isinstance(idempotency_key, str):
|
||||||
|
idempotency_key = idempotency_key.strip() or None
|
||||||
|
existing = _existing_idempotent(idempotency_key)
|
||||||
|
if existing is not None:
|
||||||
|
return existing
|
||||||
|
|
||||||
|
prepared_attachments = prepare_attachments(attachments)
|
||||||
|
notification_type = _resolve_type(type)
|
||||||
|
if notification_type is not None and not notification_type.is_active:
|
||||||
|
raise ValueError(f"Notification type {notification_type.code} is inactive")
|
||||||
|
|
||||||
|
if not verb:
|
||||||
|
verb = notification_type.verb if notification_type is not None else None
|
||||||
|
if not verb:
|
||||||
|
raise ValueError("verb is required")
|
||||||
|
|
||||||
|
if not recipients:
|
||||||
|
raise ValueError("At least one recipient is required")
|
||||||
|
|
||||||
|
stored_attachments = []
|
||||||
|
try:
|
||||||
|
with transaction.atomic():
|
||||||
|
for recipient_data in recipients:
|
||||||
|
if not (recipient_data.get("channels") or []):
|
||||||
|
raise ValueError("Recipient has no channels")
|
||||||
|
to_create = recipients
|
||||||
|
if group:
|
||||||
|
to_create, grouped = _collapse_grouped(
|
||||||
|
notification_type,
|
||||||
|
recipients,
|
||||||
|
object_id or "",
|
||||||
|
verb,
|
||||||
|
)
|
||||||
|
for grouped_notification in grouped:
|
||||||
|
store_attachments(grouped_notification, prepared_attachments, stored_attachments)
|
||||||
|
if not to_create:
|
||||||
|
return grouped[0]
|
||||||
|
fields = dict(
|
||||||
|
url=url,
|
||||||
|
type=notification_type,
|
||||||
|
level=level,
|
||||||
|
verb=verb,
|
||||||
|
object_id=object_id or "",
|
||||||
|
description=description,
|
||||||
|
data=data or {},
|
||||||
|
idempotency_key=idempotency_key,
|
||||||
|
)
|
||||||
|
if expires_at is not None:
|
||||||
|
fields["expires_at"] = expires_at
|
||||||
|
notification = Notification.objects.create(**fields)
|
||||||
|
_attach_recipients(notification, to_create, notification_type)
|
||||||
|
store_attachments(notification, prepared_attachments, stored_attachments)
|
||||||
|
except IntegrityError:
|
||||||
|
discard_attachments(stored_attachments)
|
||||||
|
existing = _existing_idempotent(idempotency_key)
|
||||||
|
if existing is None:
|
||||||
|
raise
|
||||||
|
return existing
|
||||||
|
except Exception:
|
||||||
|
discard_attachments(stored_attachments)
|
||||||
|
raise
|
||||||
|
return notification
|
||||||
|
|
||||||
|
|
||||||
|
def channel_preferences(user):
|
||||||
|
types = NotificationType.objects.filter(is_active=True, can_switch=True)
|
||||||
|
saved = {
|
||||||
|
(pref.type_id, pref.channel): pref.enabled
|
||||||
|
for pref in NotificationChannelPreference.objects.filter(user=user)
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
"code": notification_type.code,
|
||||||
|
"channels": [
|
||||||
|
{
|
||||||
|
"channel": channel,
|
||||||
|
"enabled": saved.get((notification_type.id, channel), True),
|
||||||
|
}
|
||||||
|
for channel in notification_type.channels
|
||||||
|
],
|
||||||
|
}
|
||||||
|
for notification_type in types
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def save_channel_preferences(user, items):
|
||||||
|
for item in items:
|
||||||
|
notification_type = NotificationType.objects.get(code=item["code"], can_switch=True)
|
||||||
|
for channel_item in item["channels"]:
|
||||||
|
channel = channel_item["channel"]
|
||||||
|
if channel not in notification_type.channels:
|
||||||
|
raise ValueError(
|
||||||
|
f"Channel {channel} is not allowed for {notification_type.code}"
|
||||||
|
)
|
||||||
|
NotificationChannelPreference.objects.update_or_create(
|
||||||
|
user=user,
|
||||||
|
type=notification_type,
|
||||||
|
channel=channel,
|
||||||
|
defaults={"enabled": channel_item["enabled"]},
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,117 @@
|
||||||
|
import logging
|
||||||
|
import random
|
||||||
|
|
||||||
|
from celery import shared_task
|
||||||
|
from celery.schedules import crontab
|
||||||
|
from django.db import transaction
|
||||||
|
from django.db.models import F
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
|
from notify.delivery.exceptions import PermanentDeliveryError
|
||||||
|
from notify.delivery.registry import get_provider_or_raise
|
||||||
|
from notify.models import DeliveryStatus, Notification, NotificationRecipient, VerificationCode
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"BEAT_SCHEDULE",
|
||||||
|
"deliver_notification",
|
||||||
|
"delete_expired_codes",
|
||||||
|
"delete_expired_notifications",
|
||||||
|
"retry_countdown",
|
||||||
|
]
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
RETRY_BASE_DELAY = 60
|
||||||
|
|
||||||
|
BEAT_SCHEDULE = {
|
||||||
|
"notify-delete-expired-notifications": {
|
||||||
|
"task": "notify.tasks.delete_expired_notifications",
|
||||||
|
"schedule": crontab(minute=0),
|
||||||
|
},
|
||||||
|
"notify-delete-expired-codes": {
|
||||||
|
"task": "notify.tasks.delete_expired_codes",
|
||||||
|
"schedule": crontab(minute=30),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def _mark_failed(notification_recipient_id: str, error: str) -> None:
|
||||||
|
NotificationRecipient.objects.filter(
|
||||||
|
id=notification_recipient_id,
|
||||||
|
delivery_status=DeliveryStatus.UNSENT,
|
||||||
|
).update(
|
||||||
|
delivery_status=DeliveryStatus.FAILED,
|
||||||
|
last_error=error[:2000],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _deliver_notification(notification_recipient_id: str) -> None:
|
||||||
|
error = None
|
||||||
|
with transaction.atomic():
|
||||||
|
recipient = (
|
||||||
|
NotificationRecipient.objects.select_for_update(of=("self",))
|
||||||
|
.select_related("notification__type", "user")
|
||||||
|
.filter(id=notification_recipient_id)
|
||||||
|
.first()
|
||||||
|
)
|
||||||
|
if recipient is None or recipient.delivery_status != DeliveryStatus.UNSENT:
|
||||||
|
return
|
||||||
|
NotificationRecipient.objects.filter(pk=recipient.pk).update(
|
||||||
|
attempts=F("attempts") + 1,
|
||||||
|
)
|
||||||
|
recipient.refresh_from_db(fields=["attempts"])
|
||||||
|
try:
|
||||||
|
provider = get_provider_or_raise(recipient.delivery_channel)
|
||||||
|
provider.send(recipient)
|
||||||
|
except Exception as exc:
|
||||||
|
if isinstance(exc, KeyError):
|
||||||
|
exc = PermanentDeliveryError(str(exc))
|
||||||
|
NotificationRecipient.objects.filter(pk=recipient.pk).update(
|
||||||
|
last_error=str(exc)[:2000],
|
||||||
|
)
|
||||||
|
error = exc
|
||||||
|
if error is not None:
|
||||||
|
raise error
|
||||||
|
|
||||||
|
|
||||||
|
def retry_countdown(retries: int) -> int:
|
||||||
|
delay = RETRY_BASE_DELAY * 2 ** retries
|
||||||
|
return delay + random.randint(0, delay // 10)
|
||||||
|
|
||||||
|
|
||||||
|
@shared_task(
|
||||||
|
bind=True,
|
||||||
|
max_retries=5,
|
||||||
|
)
|
||||||
|
def deliver_notification(self, notification_recipient_id: str):
|
||||||
|
try:
|
||||||
|
_deliver_notification(notification_recipient_id)
|
||||||
|
except PermanentDeliveryError as exc:
|
||||||
|
logger.error(
|
||||||
|
"Permanent delivery failure for recipient %s: %s",
|
||||||
|
notification_recipient_id,
|
||||||
|
exc,
|
||||||
|
)
|
||||||
|
_mark_failed(notification_recipient_id, str(exc))
|
||||||
|
except Exception as exc:
|
||||||
|
if self.request.retries >= self.max_retries:
|
||||||
|
logger.error(
|
||||||
|
"Delivery failed after retries for recipient %s: %s",
|
||||||
|
notification_recipient_id,
|
||||||
|
exc,
|
||||||
|
)
|
||||||
|
_mark_failed(notification_recipient_id, str(exc))
|
||||||
|
raise
|
||||||
|
raise self.retry(exc=exc, countdown=retry_countdown(self.request.retries)) from exc
|
||||||
|
|
||||||
|
|
||||||
|
@shared_task
|
||||||
|
def delete_expired_notifications():
|
||||||
|
deleted_count, _ = Notification.objects.filter(expires_at__lt=timezone.now()).delete()
|
||||||
|
return deleted_count
|
||||||
|
|
||||||
|
|
||||||
|
@shared_task
|
||||||
|
def delete_expired_codes():
|
||||||
|
deleted_count, _ = VerificationCode.objects.filter(expires_at__lt=timezone.now()).delete()
|
||||||
|
return deleted_count
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
{% extends "admin/change_form.html" %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block after_related_objects %}
|
||||||
|
{{ block.super }}
|
||||||
|
{% if original %}
|
||||||
|
<fieldset class="module aligned">
|
||||||
|
<h2>{% trans "Проверка подключения" %}</h2>
|
||||||
|
<div class="form-row">
|
||||||
|
<button type="button" class="button" id="mailbox-test-connection-btn" data-url="{{ mailbox_test_connection_url }}">{% trans "Проверить соединение" %}</button>
|
||||||
|
<button type="button" class="button" id="mailbox-send-test-email-btn" data-url="{{ mailbox_send_test_email_url }}">{% trans "Отправить тестовое письмо" %}</button>
|
||||||
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<pre id="mailbox-test-connection-log" style="max-width: 100%; max-height: 200px; white-space: pre-wrap; word-break: break-word; margin-top: 1em; padding: 1em; background: #f8f8f8; border: 1px solid #ddd; min-height: 3em;"></pre>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
<script type="text/javascript">
|
||||||
|
(function ($) {
|
||||||
|
$(function () {
|
||||||
|
var $log = $("#mailbox-test-connection-log");
|
||||||
|
|
||||||
|
function bindAction(buttonSelector) {
|
||||||
|
var $btn = $(buttonSelector);
|
||||||
|
var url = $btn.attr("data-url");
|
||||||
|
$btn.on("click", function () {
|
||||||
|
if (!url) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$log.text("{% trans 'Запрос…' %}");
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
type: "POST",
|
||||||
|
dataType: "text",
|
||||||
|
headers: {"X-CSRFToken": "{{ csrf_token }}"},
|
||||||
|
success: function (data) {
|
||||||
|
$log.text(data);
|
||||||
|
},
|
||||||
|
error: function (xhr) {
|
||||||
|
var t = xhr.responseText;
|
||||||
|
if (!t) {
|
||||||
|
t = xhr.status + " " + (xhr.statusText || "");
|
||||||
|
}
|
||||||
|
$log.text(t);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
bindAction("#mailbox-test-connection-btn");
|
||||||
|
bindAction("#mailbox-send-test-email-btn");
|
||||||
|
});
|
||||||
|
})(django.jQuery);
|
||||||
|
</script>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
from django.urls import path
|
||||||
|
|
||||||
|
from notify.api import api
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"urlpatterns",
|
||||||
|
]
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path("", api.urls),
|
||||||
|
]
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
[project]
|
||||||
|
name = "notify"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "Django app for user notifications"
|
||||||
|
requires-python = ">=3.10"
|
||||||
|
dependencies = [
|
||||||
|
"celery>=5.6.3",
|
||||||
|
"django>=5.0.6,<6",
|
||||||
|
"django-ace-editor>=0.1.0",
|
||||||
|
"django-ninja>=1.6.2",
|
||||||
|
"jinja2>=3.1",
|
||||||
|
"markdown>=3.10",
|
||||||
|
"pydantic[email]>=2.13",
|
||||||
|
"requests>=2.34.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[dependency-groups]
|
||||||
|
dev = [
|
||||||
|
"redis>=5",
|
||||||
|
]
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["hatchling"]
|
||||||
|
build-backend = "hatchling.build"
|
||||||
|
|
||||||
|
[tool.hatch.build.targets.wheel]
|
||||||
|
packages = ["notify"]
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
SECRET_KEY = "test-secret"
|
||||||
|
USE_TZ = True
|
||||||
|
DEBUG = True
|
||||||
|
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
||||||
|
ROOT_URLCONF = "tests.urls"
|
||||||
|
EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
"django.contrib.admin",
|
||||||
|
"django.contrib.auth",
|
||||||
|
"django.contrib.contenttypes",
|
||||||
|
"django.contrib.sessions",
|
||||||
|
"django.contrib.messages",
|
||||||
|
"django.contrib.staticfiles",
|
||||||
|
"notify",
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
"django.middleware.security.SecurityMiddleware",
|
||||||
|
"django.contrib.sessions.middleware.SessionMiddleware",
|
||||||
|
"django.middleware.common.CommonMiddleware",
|
||||||
|
"django.middleware.csrf.CsrfViewMiddleware",
|
||||||
|
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
||||||
|
"django.contrib.messages.middleware.MessageMiddleware",
|
||||||
|
]
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||||
|
"APP_DIRS": True,
|
||||||
|
"OPTIONS": {
|
||||||
|
"context_processors": [
|
||||||
|
"django.template.context_processors.request",
|
||||||
|
"django.contrib.auth.context_processors.auth",
|
||||||
|
"django.contrib.messages.context_processors.messages",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
"default": {
|
||||||
|
"ENGINE": "django.db.backends.sqlite3",
|
||||||
|
"NAME": ":memory:",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PASSWORD_HASHERS = [
|
||||||
|
"django.contrib.auth.hashers.MD5PasswordHasher",
|
||||||
|
]
|
||||||
|
|
||||||
|
STATIC_URL = "/static/"
|
||||||
|
|
@ -0,0 +1,221 @@
|
||||||
|
import uuid
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
from django.contrib import admin
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from django.core import mail
|
||||||
|
from django.test import RequestFactory, TestCase
|
||||||
|
from django.urls import reverse
|
||||||
|
|
||||||
|
from notify.admin import (
|
||||||
|
DeliveryEmailConfigAdmin,
|
||||||
|
DeliveryEmailConfigForm,
|
||||||
|
DeliveryTokenConfigForm,
|
||||||
|
NotificationAdmin,
|
||||||
|
NotificationRecipientAdmin,
|
||||||
|
)
|
||||||
|
from notify.models import (
|
||||||
|
DeliveryChannel,
|
||||||
|
DeliveryEmailConfig,
|
||||||
|
DeliveryTokenConfig,
|
||||||
|
Notification,
|
||||||
|
NotificationRecipient,
|
||||||
|
)
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
class EmailAdminTests(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.admin = User.objects.create_superuser("admin", "admin@example.com", "pass")
|
||||||
|
self.config = DeliveryEmailConfig.objects.create(
|
||||||
|
name="smtp",
|
||||||
|
channel=DeliveryChannel.EMAIL,
|
||||||
|
host="smtp.example.com",
|
||||||
|
port=587,
|
||||||
|
username="mailbox",
|
||||||
|
password="s3cret-smtp",
|
||||||
|
from_email="noreply@example.com",
|
||||||
|
test_email="qa@example.com",
|
||||||
|
use_ssl=False,
|
||||||
|
use_tls=False,
|
||||||
|
)
|
||||||
|
self.client.force_login(self.admin)
|
||||||
|
self.connection_url = reverse(
|
||||||
|
"admin:notify_deliveryemailconfig_test_connection",
|
||||||
|
args=[self.config.pk],
|
||||||
|
)
|
||||||
|
self.send_url = reverse(
|
||||||
|
"admin:notify_deliveryemailconfig_send_test_email",
|
||||||
|
args=[self.config.pk],
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_email_admin_uses_the_email_form(self):
|
||||||
|
self.assertIs(DeliveryEmailConfigAdmin.form, DeliveryEmailConfigForm)
|
||||||
|
self.assertIs(DeliveryEmailConfigForm._meta.model, DeliveryEmailConfig)
|
||||||
|
self.assertIs(DeliveryTokenConfigForm._meta.model, DeliveryTokenConfig)
|
||||||
|
|
||||||
|
def test_password_is_not_rendered_and_empty_submit_keeps_it(self):
|
||||||
|
html = DeliveryEmailConfigForm(instance=self.config).as_p()
|
||||||
|
self.assertNotIn("s3cret-smtp", html)
|
||||||
|
form = DeliveryEmailConfigForm(
|
||||||
|
data={
|
||||||
|
"name": self.config.name,
|
||||||
|
"channel": self.config.channel,
|
||||||
|
"host": self.config.host,
|
||||||
|
"port": self.config.port,
|
||||||
|
"username": self.config.username,
|
||||||
|
"password": "",
|
||||||
|
"from_email": self.config.from_email,
|
||||||
|
"test_email": self.config.test_email,
|
||||||
|
"use_tls": "on",
|
||||||
|
},
|
||||||
|
instance=self.config,
|
||||||
|
)
|
||||||
|
self.assertTrue(form.is_valid(), form.errors)
|
||||||
|
self.assertEqual(form.cleaned_data["password"], "s3cret-smtp")
|
||||||
|
|
||||||
|
def test_connection_check_is_post_and_hides_the_secret(self):
|
||||||
|
response = self.client.get(self.connection_url)
|
||||||
|
self.assertEqual(response.status_code, 405)
|
||||||
|
|
||||||
|
with patch("notify.admin_views.get_connection", side_effect=RuntimeError("password=s3cret-smtp")):
|
||||||
|
response = self.client.post(self.connection_url)
|
||||||
|
body = response.content.decode()
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
self.assertIn("RuntimeError", body)
|
||||||
|
self.assertNotIn("Traceback", body)
|
||||||
|
self.assertNotIn("s3cret-smtp", body)
|
||||||
|
|
||||||
|
def test_token_is_not_rendered(self):
|
||||||
|
config = DeliveryTokenConfig.objects.create(
|
||||||
|
name="max",
|
||||||
|
channel=DeliveryChannel.MAX,
|
||||||
|
token="max-token-value",
|
||||||
|
)
|
||||||
|
html = DeliveryTokenConfigForm(instance=config).as_p()
|
||||||
|
self.assertNotIn("max-token-value", html)
|
||||||
|
channel_values = [choice[0] for choice in DeliveryTokenConfigForm().fields["channel"].choices]
|
||||||
|
self.assertEqual(channel_values, [DeliveryChannel.TELEGRAM, DeliveryChannel.MAX])
|
||||||
|
|
||||||
|
def test_empty_token_keeps_the_stored_value_and_a_new_one_replaces_it(self):
|
||||||
|
config = DeliveryTokenConfig.objects.create(
|
||||||
|
name="max",
|
||||||
|
channel=DeliveryChannel.MAX,
|
||||||
|
token="max-token-value",
|
||||||
|
)
|
||||||
|
kept = DeliveryTokenConfigForm(
|
||||||
|
data={"name": config.name, "channel": config.channel, "token": ""},
|
||||||
|
instance=config,
|
||||||
|
)
|
||||||
|
self.assertTrue(kept.is_valid(), kept.errors)
|
||||||
|
self.assertEqual(kept.cleaned_data["token"], "max-token-value")
|
||||||
|
|
||||||
|
replaced = DeliveryTokenConfigForm(
|
||||||
|
data={"name": config.name, "channel": config.channel, "token": "next-token"},
|
||||||
|
instance=config,
|
||||||
|
)
|
||||||
|
self.assertTrue(replaced.is_valid(), replaced.errors)
|
||||||
|
self.assertEqual(replaced.cleaned_data["token"], "next-token")
|
||||||
|
|
||||||
|
def test_new_password_replaces_the_stored_one(self):
|
||||||
|
form = DeliveryEmailConfigForm(
|
||||||
|
data={
|
||||||
|
"name": self.config.name,
|
||||||
|
"channel": self.config.channel,
|
||||||
|
"host": self.config.host,
|
||||||
|
"port": self.config.port,
|
||||||
|
"username": self.config.username,
|
||||||
|
"password": "next-secret",
|
||||||
|
"from_email": self.config.from_email,
|
||||||
|
"test_email": self.config.test_email,
|
||||||
|
"use_tls": "on",
|
||||||
|
},
|
||||||
|
instance=self.config,
|
||||||
|
)
|
||||||
|
self.assertTrue(form.is_valid(), form.errors)
|
||||||
|
self.assertEqual(form.cleaned_data["password"], "next-secret")
|
||||||
|
|
||||||
|
def test_change_page_links_the_smtp_actions(self):
|
||||||
|
url = reverse("admin:notify_deliveryemailconfig_change", args=[self.config.pk])
|
||||||
|
response = self.client.get(url)
|
||||||
|
self.assertContains(response, self.connection_url)
|
||||||
|
self.assertContains(response, self.send_url)
|
||||||
|
|
||||||
|
def test_connection_check_reports_success_without_the_secret(self):
|
||||||
|
response = self.client.post(self.connection_url)
|
||||||
|
body = response.content.decode()
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
self.assertIn("Подключение к SMTP успешно", body)
|
||||||
|
self.assertNotIn(self.config.password, body)
|
||||||
|
|
||||||
|
def test_send_test_email_uses_the_configured_address(self):
|
||||||
|
response = self.client.post(self.send_url)
|
||||||
|
body = response.content.decode()
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
self.assertIn("Тестовое письмо отправлено", body)
|
||||||
|
self.assertNotIn(self.config.password, body)
|
||||||
|
self.assertEqual(len(mail.outbox), 1)
|
||||||
|
self.assertEqual(mail.outbox[0].to, ["qa@example.com"])
|
||||||
|
self.assertEqual(mail.outbox[0].subject, "SMTP test message")
|
||||||
|
|
||||||
|
def test_send_test_email_requires_post_and_an_address(self):
|
||||||
|
self.assertEqual(self.client.get(self.send_url).status_code, 405)
|
||||||
|
self.config.test_email = ""
|
||||||
|
self.config.save(update_fields=["test_email"])
|
||||||
|
response = self.client.post(self.send_url)
|
||||||
|
self.assertIn("Test email", response.content.decode())
|
||||||
|
self.assertEqual(len(mail.outbox), 0)
|
||||||
|
|
||||||
|
def test_send_test_email_hides_the_secret(self):
|
||||||
|
with patch(
|
||||||
|
"notify.admin_views.get_connection",
|
||||||
|
side_effect=RuntimeError("password=s3cret-smtp"),
|
||||||
|
):
|
||||||
|
response = self.client.post(self.send_url)
|
||||||
|
body = response.content.decode()
|
||||||
|
self.assertIn("RuntimeError", body)
|
||||||
|
self.assertNotIn("Traceback", body)
|
||||||
|
self.assertNotIn("s3cret-smtp", body)
|
||||||
|
|
||||||
|
def test_missing_config_is_not_found(self):
|
||||||
|
missing = uuid.uuid4()
|
||||||
|
connection = reverse("admin:notify_deliveryemailconfig_test_connection", args=[missing])
|
||||||
|
send = reverse("admin:notify_deliveryemailconfig_send_test_email", args=[missing])
|
||||||
|
self.assertEqual(self.client.post(connection).status_code, 404)
|
||||||
|
self.assertEqual(self.client.post(send).status_code, 404)
|
||||||
|
|
||||||
|
def test_staff_without_permission_is_forbidden(self):
|
||||||
|
staff = User.objects.create_user("staff", "staff@example.com", "pass", is_staff=True)
|
||||||
|
self.client.force_login(staff)
|
||||||
|
self.assertEqual(self.client.post(self.connection_url).status_code, 403)
|
||||||
|
self.assertEqual(self.client.post(self.send_url).status_code, 403)
|
||||||
|
|
||||||
|
|
||||||
|
class NotificationAdminTests(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.admin_user = User.objects.create_superuser("admin", "admin@example.com", "pass")
|
||||||
|
self.client.force_login(self.admin_user)
|
||||||
|
self.note = Notification.objects.create(verb="Hello")
|
||||||
|
|
||||||
|
def test_notifications_are_read_only(self):
|
||||||
|
request = RequestFactory().get("/")
|
||||||
|
request.user = self.admin_user
|
||||||
|
self.assertFalse(NotificationAdmin(Notification, admin.site).has_change_permission(request))
|
||||||
|
self.assertFalse(
|
||||||
|
NotificationRecipientAdmin(NotificationRecipient, admin.site).has_change_permission(request)
|
||||||
|
)
|
||||||
|
self.assertIn(
|
||||||
|
"user__username",
|
||||||
|
NotificationRecipientAdmin(NotificationRecipient, admin.site).get_search_fields(request),
|
||||||
|
)
|
||||||
|
|
||||||
|
change = reverse("admin:notify_notification_change", args=[self.note.pk])
|
||||||
|
response = self.client.get(change)
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
self.assertFalse(response.context["has_change_permission"])
|
||||||
|
self.assertEqual(self.client.post(change, {"verb": "Changed"}).status_code, 403)
|
||||||
|
self.note.refresh_from_db()
|
||||||
|
self.assertEqual(self.note.verb, "Hello")
|
||||||
|
listing = reverse("admin:notify_notification_changelist")
|
||||||
|
self.assertEqual(self.client.get(listing).status_code, 200)
|
||||||
|
|
@ -0,0 +1,303 @@
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from django.test import TestCase
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
|
from notify.api_pagination import CustomPagination
|
||||||
|
from notify.models import DeliveryChannel, NotificationGroup, NotificationRecipient, NotificationType
|
||||||
|
from notify.services import create_notification
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
class ApiTests(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.user = User.objects.create_user("alice", "alice@example.com", "pass")
|
||||||
|
self.other = User.objects.create_user("bob", "bob@example.com", "pass")
|
||||||
|
self.client.force_login(self.user)
|
||||||
|
|
||||||
|
def _browser(self, user, verb, expires_at=None, **extra):
|
||||||
|
if expires_at is not None:
|
||||||
|
extra["expires_at"] = expires_at
|
||||||
|
return create_notification(
|
||||||
|
verb=verb,
|
||||||
|
recipients=[{"user": user, "channels": [{"channel": DeliveryChannel.BROWSER}]}],
|
||||||
|
**extra,
|
||||||
|
)
|
||||||
|
|
||||||
|
def _type(self, code):
|
||||||
|
group, _ = NotificationGroup.objects.get_or_create(
|
||||||
|
code="catalog",
|
||||||
|
defaults={"name": "Catalog"},
|
||||||
|
)
|
||||||
|
return NotificationType.objects.create(
|
||||||
|
code=code,
|
||||||
|
name=code,
|
||||||
|
group=group,
|
||||||
|
channels=[DeliveryChannel.BROWSER, DeliveryChannel.EMAIL],
|
||||||
|
verb=code,
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_expired_notifications_are_hidden(self):
|
||||||
|
self._browser(self.user, "fresh")
|
||||||
|
self._browser(self.user, "stale", expires_at=timezone.now() - timedelta(minutes=1))
|
||||||
|
self._browser(self.other, "foreign")
|
||||||
|
|
||||||
|
unread = self.client.get("/api/unread-count/")
|
||||||
|
self.assertEqual(unread.status_code, 200)
|
||||||
|
self.assertEqual(unread.json()["result"], 1)
|
||||||
|
|
||||||
|
listing = self.client.get("/api/list/")
|
||||||
|
self.assertEqual(listing.status_code, 200)
|
||||||
|
verbs = [item["verb"] for item in listing.json()["results"]]
|
||||||
|
self.assertEqual(verbs, ["fresh"])
|
||||||
|
|
||||||
|
def test_invalid_recipient_id_is_not_found(self):
|
||||||
|
response = self.client.post("/api/make-read/not-a-number/")
|
||||||
|
self.assertEqual(response.status_code, 404)
|
||||||
|
self.assertEqual(response.json()["message"], "Not found")
|
||||||
|
|
||||||
|
missing = self.client.post("/api/make-read/999999/")
|
||||||
|
self.assertEqual(missing.status_code, 404)
|
||||||
|
self.assertEqual(missing.json()["message"], "Object not found")
|
||||||
|
|
||||||
|
def test_anonymous_requests_are_rejected(self):
|
||||||
|
self.client.logout()
|
||||||
|
recipient_id = 1
|
||||||
|
for url in ("/api/unread-count/", "/api/count/", "/api/list/"):
|
||||||
|
with self.subTest(url=url):
|
||||||
|
self.assertEqual(self.client.get(url).status_code, 401)
|
||||||
|
for url in (
|
||||||
|
f"/api/make-read/{recipient_id}/",
|
||||||
|
f"/api/make-unread/{recipient_id}/",
|
||||||
|
"/api/make-all-read/",
|
||||||
|
):
|
||||||
|
with self.subTest(url=url):
|
||||||
|
self.assertEqual(self.client.post(url).status_code, 401)
|
||||||
|
|
||||||
|
def test_list_returns_the_browser_inbox(self):
|
||||||
|
kind = self._type("orders.approved")
|
||||||
|
when = timezone.now() + timedelta(days=3)
|
||||||
|
notification = self._browser(
|
||||||
|
self.user,
|
||||||
|
"Invoice paid",
|
||||||
|
expires_at=when,
|
||||||
|
type=kind,
|
||||||
|
url="https://example.com/orders/1?x=1",
|
||||||
|
object_id="1",
|
||||||
|
description="wire",
|
||||||
|
data={"n": 1},
|
||||||
|
level="SUCCESS",
|
||||||
|
)
|
||||||
|
self._browser(self.other, "foreign")
|
||||||
|
older = notification.recipients.get()
|
||||||
|
older.created_at = timezone.now() - timedelta(hours=1)
|
||||||
|
older.save(update_fields=["created_at"])
|
||||||
|
self._browser(self.user, "Newer")
|
||||||
|
|
||||||
|
listing = self.client.get("/api/list/")
|
||||||
|
self.assertEqual(listing.status_code, 200)
|
||||||
|
body = listing.json()
|
||||||
|
self.assertEqual(body["total"], 2)
|
||||||
|
self.assertEqual(body["pagination"], {"page": 1, "total_pages": 1})
|
||||||
|
self.assertEqual([item["verb"] for item in body["results"]], ["Newer", "Invoice paid"])
|
||||||
|
|
||||||
|
item = body["results"][1]
|
||||||
|
self.assertEqual(item["id"], older.id)
|
||||||
|
self.assertEqual(item["type"], "orders.approved")
|
||||||
|
self.assertEqual(item["level"], "SUCCESS")
|
||||||
|
self.assertEqual(item["url"], "https://example.com/orders/1?x=1")
|
||||||
|
self.assertEqual(item["object_id"], "1")
|
||||||
|
self.assertEqual(item["description"], "wire")
|
||||||
|
self.assertEqual(item["data"], {"n": 1})
|
||||||
|
self.assertTrue(item["unread"])
|
||||||
|
self.assertNotIn("delivery_channel", item)
|
||||||
|
self.assertNotIn("delivery_target", item)
|
||||||
|
|
||||||
|
count = self.client.get("/api/count/")
|
||||||
|
self.assertEqual(count.json()["result"], 2)
|
||||||
|
|
||||||
|
def test_other_channels_and_other_users_stay_out_of_the_inbox(self):
|
||||||
|
create_notification(
|
||||||
|
verb="mail",
|
||||||
|
recipients=[
|
||||||
|
{
|
||||||
|
"user": self.user,
|
||||||
|
"channels": [{"channel": DeliveryChannel.EMAIL, "target": {"email": "alice@example.com"}}],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
foreign = self._browser(self.other, "foreign")
|
||||||
|
self._browser(self.user, "mine")
|
||||||
|
|
||||||
|
listing = self.client.get("/api/list/")
|
||||||
|
self.assertEqual([item["verb"] for item in listing.json()["results"]], ["mine"])
|
||||||
|
|
||||||
|
foreign_id = foreign.recipients.get().id
|
||||||
|
denied = self.client.post(f"/api/make-read/{foreign_id}/")
|
||||||
|
self.assertEqual(denied.status_code, 404)
|
||||||
|
foreign.recipients.get().refresh_from_db()
|
||||||
|
self.assertTrue(foreign.recipients.get().unread)
|
||||||
|
|
||||||
|
email_id = NotificationRecipient.objects.get(delivery_channel=DeliveryChannel.EMAIL).id
|
||||||
|
self.assertEqual(self.client.post(f"/api/make-read/{email_id}/").status_code, 404)
|
||||||
|
|
||||||
|
def test_expired_recipient_cannot_be_marked(self):
|
||||||
|
stale = self._browser(self.user, "stale", expires_at=timezone.now() - timedelta(minutes=1))
|
||||||
|
response = self.client.post(f"/api/make-read/{stale.recipients.get().id}/")
|
||||||
|
self.assertEqual(response.status_code, 404)
|
||||||
|
stale.recipients.get().refresh_from_db()
|
||||||
|
self.assertTrue(stale.recipients.get().unread)
|
||||||
|
|
||||||
|
def test_make_read_and_make_unread(self):
|
||||||
|
notification = self._browser(self.user, "fresh")
|
||||||
|
recipient = notification.recipients.get()
|
||||||
|
|
||||||
|
read = self.client.post(f"/api/make-read/{recipient.id}/")
|
||||||
|
self.assertEqual(read.status_code, 200)
|
||||||
|
self.assertFalse(read.json()["unread"])
|
||||||
|
self.assertEqual(read.json()["verb"], "fresh")
|
||||||
|
self.assertEqual(self.client.get("/api/unread-count/").json()["result"], 0)
|
||||||
|
|
||||||
|
again = self.client.post(f"/api/make-unread/{recipient.id}/")
|
||||||
|
self.assertEqual(again.status_code, 200)
|
||||||
|
self.assertTrue(again.json()["unread"])
|
||||||
|
recipient.refresh_from_db()
|
||||||
|
self.assertTrue(recipient.unread)
|
||||||
|
|
||||||
|
def test_filters_narrow_the_inbox(self):
|
||||||
|
approved = self._type("orders.approved")
|
||||||
|
rejected = self._type("orders.rejected")
|
||||||
|
billing = self._type("billing.due")
|
||||||
|
self._browser(
|
||||||
|
self.user,
|
||||||
|
"Invoice paid",
|
||||||
|
type=approved,
|
||||||
|
object_id="1",
|
||||||
|
description="wire",
|
||||||
|
)
|
||||||
|
self._browser(self.user, "Nope", type=rejected, object_id="2", description="card")
|
||||||
|
self._browser(
|
||||||
|
self.user,
|
||||||
|
"Due",
|
||||||
|
type=billing,
|
||||||
|
object_id="3",
|
||||||
|
description="Invoice reminder",
|
||||||
|
)
|
||||||
|
paid = NotificationRecipient.objects.get(notification__object_id="1")
|
||||||
|
paid.make_read()
|
||||||
|
|
||||||
|
def verbs(response):
|
||||||
|
return [item["verb"] for item in response.json()["results"]]
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
verbs(self.client.get("/api/list/", {"type": "orders.approved"})),
|
||||||
|
["Invoice paid"],
|
||||||
|
)
|
||||||
|
self.assertCountEqual(
|
||||||
|
verbs(self.client.get("/api/list/", {"type__startswith": "orders"})),
|
||||||
|
["Invoice paid", "Nope"],
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
verbs(self.client.get("/api/list/", {"object_id": "2"})),
|
||||||
|
["Nope"],
|
||||||
|
)
|
||||||
|
self.assertCountEqual(
|
||||||
|
verbs(self.client.get("/api/list/", {"search": "invoice"})),
|
||||||
|
["Invoice paid", "Due"],
|
||||||
|
)
|
||||||
|
self.assertCountEqual(
|
||||||
|
verbs(self.client.get("/api/list/", {"unread": "true"})),
|
||||||
|
["Nope", "Due"],
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
verbs(self.client.get("/api/list/", {"unread": "false"})),
|
||||||
|
["Invoice paid"],
|
||||||
|
)
|
||||||
|
self.assertCountEqual(
|
||||||
|
verbs(self.client.get("/api/list/", {"object_id__ne": ["2"]})),
|
||||||
|
["Invoice paid", "Due"],
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
verbs(self.client.get("/api/list/", {"object_id__ne__in": "1,3"})),
|
||||||
|
["Nope"],
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
self.client.get("/api/count/", {"type__startswith": "orders"}).json()["result"],
|
||||||
|
2,
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_make_all_read_respects_filters(self):
|
||||||
|
orders = self._type("orders.approved")
|
||||||
|
billing = self._type("billing.due")
|
||||||
|
self._browser(self.user, "order", type=orders)
|
||||||
|
self._browser(self.user, "bill", type=billing)
|
||||||
|
self._browser(self.other, "foreign", type=orders)
|
||||||
|
self._browser(
|
||||||
|
self.user,
|
||||||
|
"old order",
|
||||||
|
type=orders,
|
||||||
|
expires_at=timezone.now() - timedelta(minutes=1),
|
||||||
|
)
|
||||||
|
mailed = create_notification(
|
||||||
|
type=orders,
|
||||||
|
recipients=[
|
||||||
|
{
|
||||||
|
"user": self.user,
|
||||||
|
"channels": [{"channel": DeliveryChannel.EMAIL, "target": {"email": "alice@example.com"}}],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
response = self.client.post("/api/make-all-read/?type=orders.approved")
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
self.assertEqual(response.json(), {})
|
||||||
|
|
||||||
|
def unread(verb):
|
||||||
|
return NotificationRecipient.objects.get(notification__verb=verb).unread
|
||||||
|
|
||||||
|
self.assertFalse(unread("order"))
|
||||||
|
self.assertTrue(unread("bill"))
|
||||||
|
self.assertTrue(unread("foreign"))
|
||||||
|
self.assertTrue(unread("old order"))
|
||||||
|
self.assertTrue(mailed.recipients.get().unread)
|
||||||
|
self.assertEqual(self.client.get("/api/unread-count/").json()["result"], 1)
|
||||||
|
|
||||||
|
def test_invalid_page_is_rejected(self):
|
||||||
|
self._browser(self.user, "fresh")
|
||||||
|
response = self.client.get("/api/list/", {"page": "0"})
|
||||||
|
self.assertEqual(response.status_code, 422)
|
||||||
|
self.assertIn("detail", response.json())
|
||||||
|
|
||||||
|
|
||||||
|
class PaginationTests(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.user = User.objects.create_user("alice", "alice@example.com", "pass")
|
||||||
|
|
||||||
|
def test_pages_are_counted_from_the_queryset(self):
|
||||||
|
for verb in ("a", "b", "c"):
|
||||||
|
create_notification(
|
||||||
|
verb=verb,
|
||||||
|
recipients=[
|
||||||
|
{"user": self.user, "channels": [{"channel": DeliveryChannel.BROWSER}]},
|
||||||
|
],
|
||||||
|
)
|
||||||
|
paginator = CustomPagination(page_size=2)
|
||||||
|
queryset = NotificationRecipient.objects.order_by("notification__verb")
|
||||||
|
|
||||||
|
first = paginator.paginate_queryset(queryset, CustomPagination.Input(page=1))
|
||||||
|
self.assertEqual(first["total"], 3)
|
||||||
|
self.assertEqual(first["pagination"], {"page": 1, "total_pages": 2})
|
||||||
|
self.assertEqual([item.notification.verb for item in first["results"]], ["a", "b"])
|
||||||
|
|
||||||
|
second = paginator.paginate_queryset(queryset, CustomPagination.Input(page=2))
|
||||||
|
self.assertEqual([item.notification.verb for item in second["results"]], ["c"])
|
||||||
|
|
||||||
|
empty = paginator.paginate_queryset(
|
||||||
|
NotificationRecipient.objects.none(),
|
||||||
|
CustomPagination.Input(page=1),
|
||||||
|
)
|
||||||
|
self.assertEqual(empty["results"], [])
|
||||||
|
self.assertEqual(empty["total"], 0)
|
||||||
|
self.assertEqual(empty["pagination"]["total_pages"], 0)
|
||||||
|
|
@ -0,0 +1,290 @@
|
||||||
|
from datetime import timedelta
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from django.core import mail
|
||||||
|
from django.core.files.base import ContentFile
|
||||||
|
from django.core.files.storage import default_storage
|
||||||
|
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||||
|
from django.test import TestCase, override_settings
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
|
from notify.models import (
|
||||||
|
DeliveryChannel,
|
||||||
|
DeliveryEmailConfig,
|
||||||
|
Notification,
|
||||||
|
NotificationAttachment,
|
||||||
|
NotificationGroup,
|
||||||
|
NotificationType,
|
||||||
|
)
|
||||||
|
from notify.services import create_notification
|
||||||
|
from notify.tasks import deliver_notification
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
MEMORY_STORAGES = {
|
||||||
|
"default": {"BACKEND": "django.core.files.storage.memory.InMemoryStorage"},
|
||||||
|
"staticfiles": {"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage"},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(STORAGES=MEMORY_STORAGES)
|
||||||
|
class AttachmentServiceTests(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.user = User.objects.create_user("alice", "alice@example.com", "pass")
|
||||||
|
self.other = User.objects.create_user("bob", "bob@example.com", "pass")
|
||||||
|
self.group = NotificationGroup.objects.create(code="orders", name="Orders")
|
||||||
|
self.kind = NotificationType.objects.create(
|
||||||
|
code="approved",
|
||||||
|
name="Approved",
|
||||||
|
group=self.group,
|
||||||
|
channels=[DeliveryChannel.BROWSER, DeliveryChannel.EMAIL],
|
||||||
|
verb="Approved",
|
||||||
|
)
|
||||||
|
|
||||||
|
def _browser(self, user, **extra):
|
||||||
|
return create_notification(
|
||||||
|
verb=extra.pop("verb", "Hello"),
|
||||||
|
recipients=[{"user": user, "channels": [{"channel": DeliveryChannel.BROWSER}]}],
|
||||||
|
**extra,
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_files_are_stored_with_a_cleaned_name(self):
|
||||||
|
uploaded = SimpleUploadedFile("notes.txt", b"abc", content_type="text/plain; charset=utf-8")
|
||||||
|
notification = self._browser(
|
||||||
|
self.user,
|
||||||
|
attachments=[
|
||||||
|
uploaded,
|
||||||
|
ContentFile(b"%PDF", name="../../secret/report.pdf"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
stored = list(notification.attachments.order_by("name"))
|
||||||
|
self.assertEqual([item.name for item in stored], ["notes.txt", "report.pdf"])
|
||||||
|
self.assertEqual(stored[0].content_type, "text/plain")
|
||||||
|
self.assertEqual(stored[0].size, 3)
|
||||||
|
self.assertEqual(stored[0].file.read(), b"abc")
|
||||||
|
self.assertEqual(stored[1].content_type, "application/pdf")
|
||||||
|
self.assertEqual(stored[1].size, 4)
|
||||||
|
self.assertTrue(default_storage.exists(stored[1].file.name))
|
||||||
|
|
||||||
|
def test_limits_reject_the_notification(self):
|
||||||
|
with override_settings(NOTIFY_MAX_ATTACHMENTS=1):
|
||||||
|
with self.assertRaisesMessage(ValueError, "At most 1 attachments are allowed"):
|
||||||
|
self._browser(
|
||||||
|
self.user,
|
||||||
|
attachments=[
|
||||||
|
ContentFile(b"a", name="a.txt"),
|
||||||
|
ContentFile(b"b", name="b.txt"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
with override_settings(NOTIFY_MAX_ATTACHMENT_BYTES=4):
|
||||||
|
with self.assertRaisesMessage(ValueError, "exceeds the size limit"):
|
||||||
|
self._browser(self.user, attachments=[ContentFile(b"hello", name="a.txt")])
|
||||||
|
with self.assertRaisesMessage(ValueError, "Attachment must have a file name"):
|
||||||
|
self._browser(self.user, attachments=[ContentFile(b"x", name="")])
|
||||||
|
with self.assertRaisesMessage(ValueError, "Attachment must be a file"):
|
||||||
|
self._browser(self.user, attachments=["nope"])
|
||||||
|
self.assertEqual(Notification.objects.count(), 0)
|
||||||
|
|
||||||
|
def test_oversized_declared_size_is_not_read(self):
|
||||||
|
class BigFile:
|
||||||
|
name = "big.bin"
|
||||||
|
size = 100
|
||||||
|
|
||||||
|
def read(self):
|
||||||
|
raise AssertionError("should not read")
|
||||||
|
|
||||||
|
with override_settings(NOTIFY_MAX_ATTACHMENT_BYTES=10):
|
||||||
|
with self.assertRaisesMessage(ValueError, "exceeds the size limit"):
|
||||||
|
self._browser(self.user, attachments=[BigFile()])
|
||||||
|
self.assertEqual(Notification.objects.count(), 0)
|
||||||
|
|
||||||
|
def test_failed_save_removes_stored_files(self):
|
||||||
|
real_save = NotificationAttachment.save
|
||||||
|
names = []
|
||||||
|
|
||||||
|
def fail_second(row, *args, **kwargs):
|
||||||
|
names.append(row.file.name)
|
||||||
|
if len(names) == 2:
|
||||||
|
raise RuntimeError("disk")
|
||||||
|
return real_save(row, *args, **kwargs)
|
||||||
|
|
||||||
|
with patch("notify.attachments.NotificationAttachment.save", fail_second):
|
||||||
|
with self.assertRaisesMessage(RuntimeError, "disk"):
|
||||||
|
self._browser(
|
||||||
|
self.user,
|
||||||
|
attachments=[
|
||||||
|
ContentFile(b"one", name="first.txt"),
|
||||||
|
ContentFile(b"two", name="second.txt"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(Notification.objects.count(), 0)
|
||||||
|
self.assertEqual(NotificationAttachment.objects.count(), 0)
|
||||||
|
self.assertEqual(len(names), 2)
|
||||||
|
for name in names:
|
||||||
|
self.assertFalse(default_storage.exists(name))
|
||||||
|
|
||||||
|
def test_same_idempotency_key_does_not_add_files(self):
|
||||||
|
first = self._browser(self.user, idempotency_key="approved:9")
|
||||||
|
with override_settings(NOTIFY_MAX_ATTACHMENT_BYTES=1):
|
||||||
|
second = self._browser(
|
||||||
|
self.user,
|
||||||
|
verb="Other",
|
||||||
|
idempotency_key="approved:9",
|
||||||
|
attachments=[ContentFile(b"hello", name="late.txt")],
|
||||||
|
)
|
||||||
|
self.assertEqual(second.pk, first.pk)
|
||||||
|
self.assertEqual(first.attachments.count(), 0)
|
||||||
|
|
||||||
|
def test_group_copies_files_onto_collapsed_and_new_notifications(self):
|
||||||
|
first = create_notification(
|
||||||
|
type=self.kind,
|
||||||
|
object_id="post-9",
|
||||||
|
group=True,
|
||||||
|
recipients=[{"user": self.user, "channels": [{"channel": DeliveryChannel.BROWSER}]}],
|
||||||
|
)
|
||||||
|
second = create_notification(
|
||||||
|
type=self.kind,
|
||||||
|
object_id="post-9",
|
||||||
|
verb="Ещё",
|
||||||
|
group=True,
|
||||||
|
attachments=[ContentFile(b"note", name="note.txt")],
|
||||||
|
recipients=[
|
||||||
|
{"user": self.user, "channels": [{"channel": DeliveryChannel.BROWSER}]},
|
||||||
|
{"user": self.other, "channels": [{"channel": DeliveryChannel.BROWSER}]},
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertNotEqual(second.pk, first.pk)
|
||||||
|
self.assertEqual(Notification.objects.count(), 2)
|
||||||
|
self.assertEqual(first.attachments.get().name, "note.txt")
|
||||||
|
self.assertEqual(second.attachments.get().file.read(), b"note")
|
||||||
|
self.assertNotEqual(first.attachments.get().file.name, second.attachments.get().file.name)
|
||||||
|
|
||||||
|
collapsed = create_notification(
|
||||||
|
type=self.kind,
|
||||||
|
object_id="post-9",
|
||||||
|
group=True,
|
||||||
|
attachments=[ContentFile(b"more", name="more.txt")],
|
||||||
|
recipients=[{"user": self.user, "channels": [{"channel": DeliveryChannel.BROWSER}]}],
|
||||||
|
)
|
||||||
|
self.assertEqual(collapsed.pk, first.pk)
|
||||||
|
self.assertEqual(set(first.attachments.values_list("name", flat=True)), {"note.txt", "more.txt"})
|
||||||
|
self.assertEqual(Notification.objects.count(), 2)
|
||||||
|
|
||||||
|
def test_deleting_a_notification_deletes_its_file(self):
|
||||||
|
notification = self._browser(self.user, attachments=[ContentFile(b"gone", name="gone.txt")])
|
||||||
|
other = self._browser(self.other, attachments=[ContentFile(b"stay", name="stay.txt")])
|
||||||
|
removed = notification.attachments.get().file.name
|
||||||
|
kept = other.attachments.get().file.name
|
||||||
|
Notification.objects.filter(pk=notification.pk).delete()
|
||||||
|
self.assertFalse(default_storage.exists(removed))
|
||||||
|
self.assertTrue(default_storage.exists(kept))
|
||||||
|
self.assertEqual(other.attachments.get().file.read(), b"stay")
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(STORAGES=MEMORY_STORAGES)
|
||||||
|
class AttachmentApiTests(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.user = User.objects.create_user("alice", "alice@example.com", "pass")
|
||||||
|
self.other = User.objects.create_user("bob", "bob@example.com", "pass")
|
||||||
|
self.client.force_login(self.user)
|
||||||
|
|
||||||
|
def test_list_and_download_are_limited_to_the_recipient(self):
|
||||||
|
create_notification(
|
||||||
|
verb="With file",
|
||||||
|
attachments=[ContentFile(b"hello", name="report.txt")],
|
||||||
|
recipients=[{"user": self.user, "channels": [{"channel": DeliveryChannel.BROWSER}]}],
|
||||||
|
)
|
||||||
|
create_notification(
|
||||||
|
verb="Foreign",
|
||||||
|
attachments=[ContentFile(b"secret", name="secret.txt")],
|
||||||
|
recipients=[{"user": self.other, "channels": [{"channel": DeliveryChannel.BROWSER}]}],
|
||||||
|
)
|
||||||
|
listing = self.client.get("/api/list/")
|
||||||
|
self.assertEqual(listing.status_code, 200)
|
||||||
|
item = listing.json()["results"][0]
|
||||||
|
self.assertEqual(item["verb"], "With file")
|
||||||
|
self.assertEqual(len(item["attachments"]), 1)
|
||||||
|
attachment = item["attachments"][0]
|
||||||
|
self.assertEqual(attachment["name"], "report.txt")
|
||||||
|
self.assertEqual(attachment["size"], 5)
|
||||||
|
self.assertEqual(attachment["content_type"], "text/plain")
|
||||||
|
self.assertIn("/api/attachments/", attachment["url"])
|
||||||
|
|
||||||
|
downloaded = self.client.get(attachment["url"])
|
||||||
|
self.assertEqual(downloaded.status_code, 200)
|
||||||
|
self.assertEqual(b"".join(downloaded.streaming_content), b"hello")
|
||||||
|
self.assertIn("report.txt", downloaded["Content-Disposition"])
|
||||||
|
|
||||||
|
foreign = NotificationAttachment.objects.get(name="secret.txt")
|
||||||
|
hidden = self.client.get(f"/api/attachments/{foreign.id}/")
|
||||||
|
self.assertEqual(hidden.status_code, 404)
|
||||||
|
self.assertEqual(hidden.json()["message"], "Not found")
|
||||||
|
|
||||||
|
self.client.logout()
|
||||||
|
anonymous = self.client.get(attachment["url"])
|
||||||
|
self.assertEqual(anonymous.status_code, 401)
|
||||||
|
|
||||||
|
def test_expired_and_invalid_ids_are_hidden(self):
|
||||||
|
notification = create_notification(
|
||||||
|
verb="Stale",
|
||||||
|
expires_at=timezone.now() - timedelta(minutes=1),
|
||||||
|
attachments=[ContentFile(b"old", name="old.txt")],
|
||||||
|
recipients=[{"user": self.user, "channels": [{"channel": DeliveryChannel.BROWSER}]}],
|
||||||
|
)
|
||||||
|
attachment = notification.attachments.get()
|
||||||
|
missing = self.client.get(f"/api/attachments/{attachment.id}/")
|
||||||
|
self.assertEqual(missing.status_code, 404)
|
||||||
|
invalid = self.client.get("/api/attachments/not-a-number/")
|
||||||
|
self.assertEqual(invalid.status_code, 404)
|
||||||
|
|
||||||
|
def test_email_recipient_can_download(self):
|
||||||
|
notification = create_notification(
|
||||||
|
verb="Mail",
|
||||||
|
attachments=[ContentFile(b"body", name="body.txt")],
|
||||||
|
recipients=[
|
||||||
|
{
|
||||||
|
"user": self.user,
|
||||||
|
"channels": [{"channel": DeliveryChannel.EMAIL, "target": {"email": "alice@example.com"}}],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
attachment = notification.attachments.get()
|
||||||
|
downloaded = self.client.get(f"/api/attachments/{attachment.id}/")
|
||||||
|
self.assertEqual(downloaded.status_code, 200)
|
||||||
|
self.assertEqual(b"".join(downloaded.streaming_content), b"body")
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(STORAGES=MEMORY_STORAGES)
|
||||||
|
class AttachmentEmailTests(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.user = User.objects.create_user("alice", "alice@example.com", "pass")
|
||||||
|
DeliveryEmailConfig.objects.create(
|
||||||
|
name="default-smtp",
|
||||||
|
channel=DeliveryChannel.EMAIL,
|
||||||
|
is_default=True,
|
||||||
|
host="smtp.example.com",
|
||||||
|
port=587,
|
||||||
|
from_email="noreply@example.com",
|
||||||
|
use_ssl=False,
|
||||||
|
use_tls=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_email_includes_the_file(self):
|
||||||
|
notification = create_notification(
|
||||||
|
verb="Hello",
|
||||||
|
description="Body",
|
||||||
|
attachments=[ContentFile(b"pdf-bytes", name="report.pdf")],
|
||||||
|
recipients=[
|
||||||
|
{
|
||||||
|
"user": self.user,
|
||||||
|
"channels": [{"channel": DeliveryChannel.EMAIL, "target": {"email": "alice@example.com"}}],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
recipient = notification.recipients.get()
|
||||||
|
deliver_notification.apply(args=[str(recipient.id)], throw=True)
|
||||||
|
self.assertEqual(
|
||||||
|
mail.outbox[0].attachments,
|
||||||
|
[("report.pdf", b"pdf-bytes", "application/pdf")],
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,214 @@
|
||||||
|
import re
|
||||||
|
from datetime import timedelta
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
import requests
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from django.core import mail
|
||||||
|
from django.test import TestCase, override_settings
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
|
from notify.codes import CodeThrottled, send_code, verify_code
|
||||||
|
from notify.delivery.exceptions import DeliveryError, PermanentDeliveryError
|
||||||
|
from notify.models import (
|
||||||
|
DeliveryChannel,
|
||||||
|
DeliveryEmailConfig,
|
||||||
|
DeliveryTokenConfig,
|
||||||
|
NotificationGroup,
|
||||||
|
NotificationTemplate,
|
||||||
|
NotificationType,
|
||||||
|
VerificationCode,
|
||||||
|
)
|
||||||
|
from notify.tasks import delete_expired_codes
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
CODE_RE = re.compile(r"\b(\d{6})\b")
|
||||||
|
|
||||||
|
|
||||||
|
class FakeResponse:
|
||||||
|
def __init__(self, status_code=200):
|
||||||
|
self.status_code = status_code
|
||||||
|
|
||||||
|
def raise_for_status(self):
|
||||||
|
if self.status_code >= 400:
|
||||||
|
raise requests.HTTPError(response=self)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(NOTIFY_CODE_RESEND_INTERVAL=0)
|
||||||
|
class CodeTests(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.user = User.objects.create_user("alice", "alice@example.com", "pass")
|
||||||
|
DeliveryEmailConfig.objects.create(
|
||||||
|
name="smtp",
|
||||||
|
channel=DeliveryChannel.EMAIL,
|
||||||
|
is_default=True,
|
||||||
|
host="smtp.example.com",
|
||||||
|
from_email="noreply@example.com",
|
||||||
|
use_tls=False,
|
||||||
|
)
|
||||||
|
DeliveryTokenConfig.objects.create(
|
||||||
|
name="tg", channel=DeliveryChannel.TELEGRAM, is_default=True, token="tg-token"
|
||||||
|
)
|
||||||
|
DeliveryTokenConfig.objects.create(
|
||||||
|
name="max", channel=DeliveryChannel.MAX, is_default=True, token="max-token"
|
||||||
|
)
|
||||||
|
|
||||||
|
def _send_email(self, **kwargs):
|
||||||
|
kwargs.setdefault("purpose", "login")
|
||||||
|
kwargs.setdefault("target", {"email": "Alice@Example.com"})
|
||||||
|
send_code(channel=DeliveryChannel.EMAIL, **kwargs)
|
||||||
|
return CODE_RE.search(mail.outbox[-1].body).group(1)
|
||||||
|
|
||||||
|
def _send_messenger(self, channel, target, **kwargs):
|
||||||
|
with patch("requests.post", return_value=FakeResponse()) as post:
|
||||||
|
send_code(purpose="login", channel=channel, target=target, **kwargs)
|
||||||
|
return post, CODE_RE.search(post.call_args.kwargs["json"]["text"]).group(1)
|
||||||
|
|
||||||
|
def test_email_send_and_verify(self):
|
||||||
|
code = self._send_email(user=self.user)
|
||||||
|
verification = VerificationCode.objects.get()
|
||||||
|
self.assertEqual(verification.target_key, "alice@example.com")
|
||||||
|
self.assertEqual(verification.user, self.user)
|
||||||
|
self.assertNotIn(code, verification.code_hash)
|
||||||
|
self.assertEqual(mail.outbox[0].to, ["Alice@example.com"])
|
||||||
|
self.assertTrue(
|
||||||
|
verify_code(purpose="login", channel="email", target={"email": "alice@example.com"}, code=code)
|
||||||
|
)
|
||||||
|
verification.refresh_from_db()
|
||||||
|
self.assertIsNotNone(verification.consumed_at)
|
||||||
|
|
||||||
|
def test_telegram_send_and_verify(self):
|
||||||
|
post, code = self._send_messenger(DeliveryChannel.TELEGRAM, {"chat_id": 42})
|
||||||
|
self.assertEqual(post.call_args.kwargs["json"]["chat_id"], 42)
|
||||||
|
self.assertTrue(verify_code(purpose="login", channel="telegram", target={"chat_id": 42}, code=code))
|
||||||
|
|
||||||
|
def test_max_send_and_verify(self):
|
||||||
|
target = {"chat_id": 5, "user_id": 7}
|
||||||
|
post, code = self._send_messenger(DeliveryChannel.MAX, target)
|
||||||
|
self.assertEqual(post.call_args.kwargs["params"], {"user_id": 7})
|
||||||
|
verification = VerificationCode.objects.get()
|
||||||
|
self.assertEqual(verification.target_key, "user:7")
|
||||||
|
self.assertEqual(verification.delivery_target, target)
|
||||||
|
self.assertTrue(verify_code(purpose="login", channel="max", target=target, code=code))
|
||||||
|
|
||||||
|
def test_wrong_code_counts_attempt(self):
|
||||||
|
code = self._send_email()
|
||||||
|
wrong = "000000" if code != "000000" else "111111"
|
||||||
|
self.assertFalse(verify_code(purpose="login", channel="email", target={"email": "alice@example.com"}, code=wrong))
|
||||||
|
self.assertEqual(VerificationCode.objects.get().attempts, 1)
|
||||||
|
self.assertTrue(verify_code(purpose="login", channel="email", target={"email": "alice@example.com"}, code=code))
|
||||||
|
|
||||||
|
@override_settings(NOTIFY_CODE_MAX_ATTEMPTS=2)
|
||||||
|
def test_attempts_exhausted(self):
|
||||||
|
code = self._send_email()
|
||||||
|
wrong = "000000" if code != "000000" else "111111"
|
||||||
|
for _ in range(2):
|
||||||
|
verify_code(purpose="login", channel="email", target={"email": "alice@example.com"}, code=wrong)
|
||||||
|
self.assertFalse(verify_code(purpose="login", channel="email", target={"email": "alice@example.com"}, code=code))
|
||||||
|
self.assertEqual(VerificationCode.objects.get().attempts, 2)
|
||||||
|
|
||||||
|
def test_expired_code_rejected(self):
|
||||||
|
code = self._send_email()
|
||||||
|
VerificationCode.objects.update(expires_at=timezone.now() - timedelta(seconds=1))
|
||||||
|
self.assertFalse(verify_code(purpose="login", channel="email", target={"email": "alice@example.com"}, code=code))
|
||||||
|
|
||||||
|
def test_code_is_single_use(self):
|
||||||
|
code = self._send_email()
|
||||||
|
self.assertTrue(verify_code(purpose="login", channel="email", target={"email": "alice@example.com"}, code=code))
|
||||||
|
self.assertFalse(verify_code(purpose="login", channel="email", target={"email": "alice@example.com"}, code=code))
|
||||||
|
|
||||||
|
def test_purpose_is_isolated(self):
|
||||||
|
code = self._send_email(purpose="login")
|
||||||
|
self.assertFalse(
|
||||||
|
verify_code(purpose="email_change", channel="email", target={"email": "alice@example.com"}, code=code)
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_new_code_invalidates_previous(self):
|
||||||
|
first = self._send_email()
|
||||||
|
second = self._send_email()
|
||||||
|
if first != second:
|
||||||
|
self.assertFalse(
|
||||||
|
verify_code(purpose="login", channel="email", target={"email": "alice@example.com"}, code=first)
|
||||||
|
)
|
||||||
|
self.assertEqual(VerificationCode.objects.filter(consumed_at__isnull=True).count(), 1)
|
||||||
|
self.assertTrue(verify_code(purpose="login", channel="email", target={"email": "alice@example.com"}, code=second))
|
||||||
|
|
||||||
|
@override_settings(NOTIFY_CODE_RESEND_INTERVAL=60)
|
||||||
|
def test_resend_is_throttled(self):
|
||||||
|
self._send_email()
|
||||||
|
with self.assertRaises(CodeThrottled) as ctx:
|
||||||
|
self._send_email()
|
||||||
|
self.assertGreater(ctx.exception.retry_after, 0)
|
||||||
|
self.assertEqual(VerificationCode.objects.count(), 1)
|
||||||
|
self.assertEqual(len(mail.outbox), 1)
|
||||||
|
|
||||||
|
def test_delivery_failure_rolls_back(self):
|
||||||
|
with patch("requests.post", return_value=FakeResponse(503)) as post:
|
||||||
|
with self.assertRaises(DeliveryError) as ctx:
|
||||||
|
send_code(purpose="login", channel="telegram", target={"chat_id": 42})
|
||||||
|
code = CODE_RE.search(post.call_args.kwargs["json"]["text"]).group(1)
|
||||||
|
self.assertNotIn(code, str(ctx.exception))
|
||||||
|
self.assertFalse(VerificationCode.objects.exists())
|
||||||
|
|
||||||
|
@override_settings(NOTIFY_CODE_RESEND_INTERVAL=60)
|
||||||
|
def test_failure_keeps_previous_code_and_allows_retry(self):
|
||||||
|
_, first = self._send_messenger(DeliveryChannel.TELEGRAM, {"chat_id": 42})
|
||||||
|
VerificationCode.objects.update(created_at=timezone.now() - timedelta(seconds=61))
|
||||||
|
with patch("requests.post", return_value=FakeResponse(400)):
|
||||||
|
with self.assertRaises(PermanentDeliveryError):
|
||||||
|
send_code(purpose="login", channel="telegram", target={"chat_id": 42})
|
||||||
|
self.assertTrue(verify_code(purpose="login", channel="telegram", target={"chat_id": 42}, code=first))
|
||||||
|
|
||||||
|
def test_browser_channel_rejected(self):
|
||||||
|
with self.assertRaises(ValueError):
|
||||||
|
send_code(purpose="login", channel="browser")
|
||||||
|
|
||||||
|
def test_invalid_recipient_rejected(self):
|
||||||
|
with self.assertRaises(ValueError):
|
||||||
|
send_code(purpose="login", channel="email", target={"email": "not-an-email"})
|
||||||
|
with self.assertRaises(ValueError):
|
||||||
|
send_code(purpose="login", channel="telegram")
|
||||||
|
|
||||||
|
def test_custom_template_by_type(self):
|
||||||
|
group = NotificationGroup.objects.create(code="auth", name="Auth")
|
||||||
|
notification_type = NotificationType.objects.create(
|
||||||
|
code="otp", name="OTP", verb="OTP", channels=["email"], group=group
|
||||||
|
)
|
||||||
|
NotificationTemplate.objects.create(
|
||||||
|
name="otp-email",
|
||||||
|
channel="email",
|
||||||
|
type=notification_type,
|
||||||
|
subject_template="Вход для {{ user.username }}",
|
||||||
|
body_template="<b>{{ code }}</b> на {{ ttl_minutes }} мин ({{ purpose }})",
|
||||||
|
)
|
||||||
|
code = self._send_email(user=self.user, type="otp")
|
||||||
|
message = mail.outbox[-1]
|
||||||
|
self.assertEqual(message.subject, "Вход для alice")
|
||||||
|
self.assertEqual(message.body, f"<b>{code}</b> на 5 мин (login)")
|
||||||
|
|
||||||
|
def test_default_channel_template_is_not_used(self):
|
||||||
|
NotificationTemplate.objects.create(
|
||||||
|
name="default-email",
|
||||||
|
channel="email",
|
||||||
|
is_default=True,
|
||||||
|
subject_template="{{ notification.verb }}",
|
||||||
|
body_template="{{ notification.description }}",
|
||||||
|
)
|
||||||
|
code = self._send_email()
|
||||||
|
self.assertIn(code, mail.outbox[-1].body)
|
||||||
|
|
||||||
|
@override_settings(NOTIFY_CODE_LENGTH=8)
|
||||||
|
def test_code_length_setting(self):
|
||||||
|
with patch("requests.post", return_value=FakeResponse()) as post:
|
||||||
|
send_code(purpose="login", channel="telegram", target={"chat_id": 1})
|
||||||
|
self.assertRegex(post.call_args.kwargs["json"]["text"], r"\b\d{8}\b")
|
||||||
|
|
||||||
|
def test_delete_expired_codes(self):
|
||||||
|
self._send_email()
|
||||||
|
self._send_email(purpose="other")
|
||||||
|
VerificationCode.objects.filter(purpose="other").update(
|
||||||
|
expires_at=timezone.now() - timedelta(seconds=1)
|
||||||
|
)
|
||||||
|
self.assertEqual(delete_expired_codes(), 1)
|
||||||
|
self.assertEqual(VerificationCode.objects.get().purpose, "login")
|
||||||
|
|
@ -0,0 +1,626 @@
|
||||||
|
from datetime import timedelta
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
import requests
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from django.core import mail
|
||||||
|
from django.core.exceptions import ValidationError
|
||||||
|
from django.db import IntegrityError, transaction
|
||||||
|
from django.test import TestCase
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
|
from notify.delivery import get_provider, get_provider_or_raise, registered_channels
|
||||||
|
from notify.delivery.providers.max import MAX_API_TIMEOUT
|
||||||
|
from notify.delivery.providers.telegram import TELEGRAM_API_TIMEOUT
|
||||||
|
from notify.models import (
|
||||||
|
DeliveryChannel,
|
||||||
|
DeliveryEmailConfig,
|
||||||
|
DeliveryStatus,
|
||||||
|
DeliveryTokenConfig,
|
||||||
|
Notification,
|
||||||
|
NotificationGroup,
|
||||||
|
NotificationRecipient,
|
||||||
|
NotificationTemplate,
|
||||||
|
NotificationType,
|
||||||
|
)
|
||||||
|
from notify.rendering import render
|
||||||
|
from notify.services import create_notification
|
||||||
|
from notify.tasks import RETRY_BASE_DELAY, deliver_notification, retry_countdown
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
class RetryCountdownTests(TestCase):
|
||||||
|
def test_delay_doubles_with_bounded_jitter(self):
|
||||||
|
for retries in range(5):
|
||||||
|
expected = RETRY_BASE_DELAY * 2 ** retries
|
||||||
|
for _ in range(20):
|
||||||
|
delay = retry_countdown(retries)
|
||||||
|
self.assertGreaterEqual(delay, expected)
|
||||||
|
self.assertLessEqual(delay, expected + expected // 10)
|
||||||
|
|
||||||
|
|
||||||
|
class DeliveryTests(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.user = User.objects.create_user("alice", "alice@example.com", "pass")
|
||||||
|
self.email_config = DeliveryEmailConfig.objects.create(
|
||||||
|
name="default-smtp",
|
||||||
|
channel=DeliveryChannel.EMAIL,
|
||||||
|
is_default=True,
|
||||||
|
host="smtp.example.com",
|
||||||
|
port=587,
|
||||||
|
from_email="noreply@example.com",
|
||||||
|
use_ssl=False,
|
||||||
|
use_tls=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
def _email_recipient(self, **notification_kwargs):
|
||||||
|
notification = create_notification(
|
||||||
|
verb=notification_kwargs.pop("verb", "Hello"),
|
||||||
|
description=notification_kwargs.pop("description", "Body"),
|
||||||
|
recipients=[
|
||||||
|
{
|
||||||
|
"user": self.user,
|
||||||
|
"channels": [{"channel": DeliveryChannel.EMAIL, "target": {"email": "alice@example.com"}}],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
**notification_kwargs,
|
||||||
|
)
|
||||||
|
return notification.recipients.get()
|
||||||
|
|
||||||
|
def _max_recipient(self, delivery_target=None):
|
||||||
|
DeliveryTokenConfig.objects.create(
|
||||||
|
name="max",
|
||||||
|
channel=DeliveryChannel.MAX,
|
||||||
|
is_default=True,
|
||||||
|
token="token",
|
||||||
|
)
|
||||||
|
notification = Notification.objects.create(verb="Hello", description="Body")
|
||||||
|
return NotificationRecipient.objects.create(
|
||||||
|
notification=notification,
|
||||||
|
user=self.user,
|
||||||
|
delivery_channel=DeliveryChannel.MAX,
|
||||||
|
delivery_target={"chat_id": -10} if delivery_target is None else delivery_target,
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_email_failure_is_not_marked_sent(self):
|
||||||
|
recipient = self._email_recipient()
|
||||||
|
with patch(
|
||||||
|
"notify.delivery.providers.email.EmailMessage.send",
|
||||||
|
side_effect=OSError("smtp down"),
|
||||||
|
):
|
||||||
|
result = deliver_notification.apply(args=[str(recipient.id)], throw=False)
|
||||||
|
self.assertEqual(result.state, "FAILURE")
|
||||||
|
recipient.refresh_from_db()
|
||||||
|
self.assertEqual(recipient.delivery_status, DeliveryStatus.FAILED)
|
||||||
|
self.assertEqual(recipient.attempts, 6)
|
||||||
|
self.assertIn("Email delivery failed", recipient.last_error)
|
||||||
|
self.assertIsNone(recipient.sent_at)
|
||||||
|
self.assertEqual(len(mail.outbox), 0)
|
||||||
|
|
||||||
|
def test_missing_email_config_fails_explicitly(self):
|
||||||
|
recipient = self._email_recipient()
|
||||||
|
self.email_config.delete()
|
||||||
|
result = deliver_notification.apply(args=[str(recipient.id)], throw=False)
|
||||||
|
self.assertEqual(result.state, "FAILURE")
|
||||||
|
recipient.refresh_from_db()
|
||||||
|
self.assertEqual(recipient.delivery_status, DeliveryStatus.FAILED)
|
||||||
|
|
||||||
|
def test_missing_address_is_permanent_failure(self):
|
||||||
|
notification = Notification.objects.create(verb="Hello", description="Body")
|
||||||
|
recipient = NotificationRecipient.objects.create(
|
||||||
|
notification=notification,
|
||||||
|
user=self.user,
|
||||||
|
delivery_channel=DeliveryChannel.EMAIL,
|
||||||
|
delivery_target=None,
|
||||||
|
)
|
||||||
|
deliver_notification.apply(args=[str(recipient.id)], throw=True)
|
||||||
|
recipient.refresh_from_db()
|
||||||
|
self.assertEqual(recipient.delivery_status, DeliveryStatus.FAILED)
|
||||||
|
|
||||||
|
def test_successful_email_is_sent_once_and_escapes_html(self):
|
||||||
|
recipient = self._email_recipient(
|
||||||
|
verb="Hello\r\nBcc: leak",
|
||||||
|
description="<script>alert(1)</script>",
|
||||||
|
)
|
||||||
|
deliver_notification.apply(args=[str(recipient.id)], throw=True)
|
||||||
|
deliver_notification.apply(args=[str(recipient.id)], throw=True)
|
||||||
|
recipient.refresh_from_db()
|
||||||
|
self.assertEqual(recipient.delivery_status, DeliveryStatus.SENT)
|
||||||
|
self.assertEqual(recipient.attempts, 1)
|
||||||
|
self.assertEqual(recipient.last_error, "")
|
||||||
|
self.assertIsNotNone(recipient.sent_at)
|
||||||
|
self.assertEqual(len(mail.outbox), 1)
|
||||||
|
self.assertNotIn("\n", mail.outbox[0].subject)
|
||||||
|
self.assertNotIn("<script>", mail.outbox[0].body)
|
||||||
|
self.assertIn("<script>", mail.outbox[0].body)
|
||||||
|
self.assertEqual(mail.outbox[0].from_email, "noreply@example.com")
|
||||||
|
self.assertEqual(mail.outbox[0].to, ["alice@example.com"])
|
||||||
|
|
||||||
|
def test_template_context_does_not_expose_the_user_model(self):
|
||||||
|
NotificationTemplate.objects.create(
|
||||||
|
channel=DeliveryChannel.EMAIL,
|
||||||
|
name="email-default",
|
||||||
|
is_default=True,
|
||||||
|
subject_template="{{ notification.verb }}",
|
||||||
|
body_template="hash={{ user.password }} verb={{ notification.verb }}",
|
||||||
|
)
|
||||||
|
recipient = self._email_recipient(verb="Approved", description="<b>x</b>")
|
||||||
|
deliver_notification.apply(args=[str(recipient.id)], throw=True)
|
||||||
|
body = mail.outbox[0].body
|
||||||
|
self.assertIn("verb=Approved", body)
|
||||||
|
self.assertNotIn(self.user.password, body)
|
||||||
|
self.assertNotIn("<b>", body)
|
||||||
|
|
||||||
|
def test_disallowed_channel_does_not_create_notification(self):
|
||||||
|
group = NotificationGroup.objects.create(code="orders", name="Orders")
|
||||||
|
NotificationType.objects.create(
|
||||||
|
code="approved",
|
||||||
|
name="Approved",
|
||||||
|
group=group,
|
||||||
|
channels=[DeliveryChannel.EMAIL],
|
||||||
|
verb="Approved",
|
||||||
|
)
|
||||||
|
with self.assertRaisesMessage(ValueError, "not allowed"):
|
||||||
|
create_notification(
|
||||||
|
type="approved",
|
||||||
|
recipients=[
|
||||||
|
{"user": self.user, "channels": [{"channel": DeliveryChannel.BROWSER}]},
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(Notification.objects.count(), 0)
|
||||||
|
|
||||||
|
def test_unknown_channel_does_not_create_recipient(self):
|
||||||
|
with self.assertRaisesMessage(ValueError, "No delivery provider"):
|
||||||
|
create_notification(
|
||||||
|
verb="Ping",
|
||||||
|
recipients=[
|
||||||
|
{"user": self.user, "channels": [{"channel": "sms"}]},
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(Notification.objects.count(), 0)
|
||||||
|
self.assertEqual(NotificationRecipient.objects.count(), 0)
|
||||||
|
|
||||||
|
def test_inactive_type_raises(self):
|
||||||
|
group = NotificationGroup.objects.create(code="orders", name="Orders")
|
||||||
|
NotificationType.objects.create(
|
||||||
|
code="approved",
|
||||||
|
name="Approved",
|
||||||
|
group=group,
|
||||||
|
channels=[DeliveryChannel.BROWSER],
|
||||||
|
verb="Approved",
|
||||||
|
is_active=False,
|
||||||
|
)
|
||||||
|
with self.assertRaisesMessage(ValueError, "inactive"):
|
||||||
|
create_notification(
|
||||||
|
type="approved",
|
||||||
|
recipients=[
|
||||||
|
{"user": self.user, "channels": [{"channel": DeliveryChannel.BROWSER}]},
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(Notification.objects.count(), 0)
|
||||||
|
|
||||||
|
def test_duplicate_channel_rolls_back(self):
|
||||||
|
with self.assertRaisesMessage(ValueError, "Duplicate"):
|
||||||
|
create_notification(
|
||||||
|
verb="Ping",
|
||||||
|
recipients=[
|
||||||
|
{
|
||||||
|
"user": self.user,
|
||||||
|
"channels": [
|
||||||
|
{"channel": DeliveryChannel.EMAIL, "target": {"email": "alice@example.com"}},
|
||||||
|
{"channel": DeliveryChannel.EMAIL, "target": {"email": "alice@example.com"}},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(Notification.objects.count(), 0)
|
||||||
|
|
||||||
|
def test_recipient_channel_is_unique(self):
|
||||||
|
notification = Notification.objects.create(verb="Hello")
|
||||||
|
NotificationRecipient.objects.create(
|
||||||
|
notification=notification,
|
||||||
|
user=self.user,
|
||||||
|
delivery_channel=DeliveryChannel.EMAIL,
|
||||||
|
delivery_target={"email": "alice@example.com"},
|
||||||
|
)
|
||||||
|
with self.assertRaises(IntegrityError):
|
||||||
|
with transaction.atomic():
|
||||||
|
NotificationRecipient.objects.create(
|
||||||
|
notification=notification,
|
||||||
|
user=self.user,
|
||||||
|
delivery_channel=DeliveryChannel.EMAIL,
|
||||||
|
delivery_target={"email": "other@example.com"},
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_max_request_has_timeout_and_retries_server_errors(self):
|
||||||
|
DeliveryTokenConfig.objects.create(
|
||||||
|
name="max",
|
||||||
|
channel=DeliveryChannel.MAX,
|
||||||
|
is_default=True,
|
||||||
|
token="token",
|
||||||
|
)
|
||||||
|
notification = Notification.objects.create(verb="Hello", description="Body")
|
||||||
|
recipient = NotificationRecipient.objects.create(
|
||||||
|
notification=notification,
|
||||||
|
user=self.user,
|
||||||
|
delivery_channel=DeliveryChannel.MAX,
|
||||||
|
delivery_target={"chat_id": -10},
|
||||||
|
)
|
||||||
|
response = requests.Response()
|
||||||
|
response.status_code = 503
|
||||||
|
error = requests.HTTPError("unavailable")
|
||||||
|
error.response = response
|
||||||
|
with patch("notify.delivery.providers.max.requests.post") as post:
|
||||||
|
post.return_value.raise_for_status.side_effect = error
|
||||||
|
result = deliver_notification.apply(args=[str(recipient.id)], throw=False)
|
||||||
|
self.assertEqual(result.state, "FAILURE")
|
||||||
|
self.assertGreater(post.call_count, 1)
|
||||||
|
self.assertEqual(post.call_args.kwargs["timeout"], MAX_API_TIMEOUT)
|
||||||
|
recipient.refresh_from_db()
|
||||||
|
self.assertEqual(recipient.delivery_status, DeliveryStatus.FAILED)
|
||||||
|
|
||||||
|
def test_max_client_error_is_not_retried(self):
|
||||||
|
DeliveryTokenConfig.objects.create(
|
||||||
|
name="max",
|
||||||
|
channel=DeliveryChannel.MAX,
|
||||||
|
is_default=True,
|
||||||
|
token="token",
|
||||||
|
)
|
||||||
|
notification = Notification.objects.create(verb="Hello", description="Body")
|
||||||
|
recipient = NotificationRecipient.objects.create(
|
||||||
|
notification=notification,
|
||||||
|
user=self.user,
|
||||||
|
delivery_channel=DeliveryChannel.MAX,
|
||||||
|
delivery_target={"chat_id": -10},
|
||||||
|
)
|
||||||
|
response = requests.Response()
|
||||||
|
response.status_code = 400
|
||||||
|
error = requests.HTTPError("bad request")
|
||||||
|
error.response = response
|
||||||
|
with patch("notify.delivery.providers.max.requests.post") as post:
|
||||||
|
post.return_value.raise_for_status.side_effect = error
|
||||||
|
deliver_notification.apply(args=[str(recipient.id)], throw=True)
|
||||||
|
self.assertEqual(post.call_count, 1)
|
||||||
|
recipient.refresh_from_db()
|
||||||
|
self.assertEqual(recipient.delivery_status, DeliveryStatus.FAILED)
|
||||||
|
|
||||||
|
def test_second_default_config_replaces_the_first(self):
|
||||||
|
second = DeliveryEmailConfig.objects.create(
|
||||||
|
name="other-smtp",
|
||||||
|
channel=DeliveryChannel.EMAIL,
|
||||||
|
is_default=True,
|
||||||
|
host="smtp.other.example.com",
|
||||||
|
use_ssl=False,
|
||||||
|
use_tls=False,
|
||||||
|
)
|
||||||
|
self.email_config.refresh_from_db()
|
||||||
|
self.assertFalse(self.email_config.is_default)
|
||||||
|
self.assertEqual(DeliveryEmailConfig.get_default().pk, second.pk)
|
||||||
|
|
||||||
|
def test_ssl_and_tls_together_are_rejected(self):
|
||||||
|
config = DeliveryEmailConfig(
|
||||||
|
name="bad",
|
||||||
|
channel=DeliveryChannel.EMAIL,
|
||||||
|
host="smtp.example.com",
|
||||||
|
use_ssl=True,
|
||||||
|
use_tls=True,
|
||||||
|
)
|
||||||
|
with self.assertRaises(ValidationError):
|
||||||
|
config.full_clean()
|
||||||
|
with self.assertRaises(ValidationError):
|
||||||
|
config.save()
|
||||||
|
|
||||||
|
def test_new_email_config_defaults_to_starttls(self):
|
||||||
|
config = DeliveryEmailConfig(name="new", channel=DeliveryChannel.EMAIL, host="smtp.example.com")
|
||||||
|
self.assertFalse(config.use_ssl)
|
||||||
|
self.assertTrue(config.use_tls)
|
||||||
|
|
||||||
|
def test_markdown_filter_escapes_raw_html(self):
|
||||||
|
rendered = render("{{ text | markdown }}", {"text": "<script>alert(1)</script>"})
|
||||||
|
self.assertNotIn("<script>", rendered)
|
||||||
|
self.assertIn("<script>", rendered)
|
||||||
|
|
||||||
|
def test_expired_notifications_stay_until_the_cleanup_task(self):
|
||||||
|
old = Notification.objects.create(
|
||||||
|
verb="old",
|
||||||
|
expires_at=timezone.now() - timedelta(minutes=1),
|
||||||
|
)
|
||||||
|
from notify.tasks import delete_expired_notifications
|
||||||
|
|
||||||
|
deleted = delete_expired_notifications()
|
||||||
|
self.assertEqual(deleted, 1)
|
||||||
|
self.assertFalse(Notification.objects.filter(pk=old.pk).exists())
|
||||||
|
|
||||||
|
def test_cleanup_keeps_notifications_that_have_not_expired(self):
|
||||||
|
fresh = Notification.objects.create(verb="fresh")
|
||||||
|
from notify.tasks import delete_expired_notifications
|
||||||
|
|
||||||
|
self.assertEqual(delete_expired_notifications(), 0)
|
||||||
|
self.assertTrue(Notification.objects.filter(pk=fresh.pk).exists())
|
||||||
|
|
||||||
|
def test_expired_cleanup_is_scheduled_hourly(self):
|
||||||
|
from notify.tasks import BEAT_SCHEDULE
|
||||||
|
|
||||||
|
entry = BEAT_SCHEDULE["notify-delete-expired-notifications"]
|
||||||
|
self.assertEqual(entry["task"], "notify.tasks.delete_expired_notifications")
|
||||||
|
self.assertEqual(set(entry["schedule"].minute), {0})
|
||||||
|
|
||||||
|
def test_builtin_providers_are_registered(self):
|
||||||
|
self.assertIsNotNone(get_provider(DeliveryChannel.EMAIL))
|
||||||
|
self.assertIsNotNone(get_provider(DeliveryChannel.BROWSER))
|
||||||
|
self.assertIsNotNone(get_provider(DeliveryChannel.MAX))
|
||||||
|
self.assertIsNotNone(get_provider(DeliveryChannel.TELEGRAM))
|
||||||
|
self.assertIsNone(get_provider("sms"))
|
||||||
|
with self.assertRaisesMessage(KeyError, "sms"):
|
||||||
|
get_provider_or_raise("sms")
|
||||||
|
self.assertCountEqual(
|
||||||
|
list(registered_channels()),
|
||||||
|
[
|
||||||
|
DeliveryChannel.EMAIL,
|
||||||
|
DeliveryChannel.BROWSER,
|
||||||
|
DeliveryChannel.MAX,
|
||||||
|
DeliveryChannel.TELEGRAM,
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_missing_recipient_is_a_no_op(self):
|
||||||
|
result = deliver_notification.apply(args=["999999"], throw=True)
|
||||||
|
self.assertEqual(result.state, "SUCCESS")
|
||||||
|
|
||||||
|
def test_failed_recipient_is_not_sent_again(self):
|
||||||
|
recipient = self._email_recipient()
|
||||||
|
recipient.delivery_status = DeliveryStatus.FAILED
|
||||||
|
recipient.save(update_fields=["delivery_status"])
|
||||||
|
with patch("notify.delivery.providers.email.EmailMessage.send") as send:
|
||||||
|
deliver_notification.apply(args=[str(recipient.id)], throw=True)
|
||||||
|
send.assert_not_called()
|
||||||
|
self.assertEqual(len(mail.outbox), 0)
|
||||||
|
|
||||||
|
def test_unknown_channel_fails_without_retry(self):
|
||||||
|
notification = Notification.objects.create(verb="Hello", description="Body")
|
||||||
|
recipient = NotificationRecipient.objects.create(
|
||||||
|
notification=notification,
|
||||||
|
user=self.user,
|
||||||
|
delivery_channel="sms",
|
||||||
|
)
|
||||||
|
deliver_notification.apply(args=[str(recipient.id)], throw=True)
|
||||||
|
recipient.refresh_from_db()
|
||||||
|
self.assertEqual(recipient.delivery_status, DeliveryStatus.FAILED)
|
||||||
|
|
||||||
|
def test_invalid_email_message_is_not_retried(self):
|
||||||
|
recipient = self._email_recipient()
|
||||||
|
with patch(
|
||||||
|
"notify.delivery.providers.email.EmailMessage.send",
|
||||||
|
side_effect=ValueError("bad"),
|
||||||
|
) as send:
|
||||||
|
deliver_notification.apply(args=[str(recipient.id)], throw=True)
|
||||||
|
self.assertEqual(send.call_count, 1)
|
||||||
|
recipient.refresh_from_db()
|
||||||
|
self.assertEqual(recipient.delivery_status, DeliveryStatus.FAILED)
|
||||||
|
|
||||||
|
def test_unaccepted_email_is_retried(self):
|
||||||
|
recipient = self._email_recipient()
|
||||||
|
with patch("notify.delivery.providers.email.EmailMessage.send", return_value=0) as send:
|
||||||
|
result = deliver_notification.apply(args=[str(recipient.id)], throw=False)
|
||||||
|
self.assertEqual(result.state, "FAILURE")
|
||||||
|
self.assertEqual(send.call_count, 6)
|
||||||
|
recipient.refresh_from_db()
|
||||||
|
self.assertEqual(recipient.delivery_status, DeliveryStatus.FAILED)
|
||||||
|
|
||||||
|
def test_typed_template_wins_over_the_channel_default(self):
|
||||||
|
group = NotificationGroup.objects.create(code="orders", name="Orders")
|
||||||
|
kind = NotificationType.objects.create(
|
||||||
|
code="approved",
|
||||||
|
name="Approved",
|
||||||
|
group=group,
|
||||||
|
channels=[DeliveryChannel.EMAIL],
|
||||||
|
verb="Approved",
|
||||||
|
)
|
||||||
|
NotificationTemplate.objects.create(
|
||||||
|
channel=DeliveryChannel.EMAIL,
|
||||||
|
name="email-default",
|
||||||
|
is_default=True,
|
||||||
|
subject_template="default {{ notification.verb }}",
|
||||||
|
body_template="DEFAULT {{ notification.url }}",
|
||||||
|
)
|
||||||
|
NotificationTemplate.objects.create(
|
||||||
|
channel=DeliveryChannel.EMAIL,
|
||||||
|
type=kind,
|
||||||
|
name="approved-email",
|
||||||
|
subject_template="typed {{ notification.verb }}",
|
||||||
|
body_template="TYPED {{ notification.url }}",
|
||||||
|
)
|
||||||
|
recipient = self._email_recipient(
|
||||||
|
type=kind,
|
||||||
|
verb="Approved",
|
||||||
|
url="https://example.com/orders/9",
|
||||||
|
description="plain",
|
||||||
|
)
|
||||||
|
deliver_notification.apply(args=[str(recipient.id)], throw=True)
|
||||||
|
self.assertEqual(mail.outbox[0].subject, "typed Approved")
|
||||||
|
self.assertIn("TYPED https://example.com/orders/9", mail.outbox[0].body)
|
||||||
|
self.assertNotIn("DEFAULT", mail.outbox[0].body)
|
||||||
|
|
||||||
|
def test_email_ignores_another_channels_template(self):
|
||||||
|
NotificationTemplate.objects.create(
|
||||||
|
channel=DeliveryChannel.MAX,
|
||||||
|
name="max-only",
|
||||||
|
is_default=True,
|
||||||
|
body_template="MAX-ONLY {{ notification.verb }}",
|
||||||
|
)
|
||||||
|
recipient = self._email_recipient(verb="Approved", description="plain")
|
||||||
|
deliver_notification.apply(args=[str(recipient.id)], throw=True)
|
||||||
|
self.assertNotIn("MAX-ONLY", mail.outbox[0].body)
|
||||||
|
self.assertIn("plain", mail.outbox[0].body)
|
||||||
|
|
||||||
|
def test_max_message_is_sent_and_marked(self):
|
||||||
|
recipient = self._max_recipient({"chat_id": 15, "user_id": 4})
|
||||||
|
response = requests.Response()
|
||||||
|
response.status_code = 200
|
||||||
|
with patch("notify.delivery.providers.max.requests.post", return_value=response) as post:
|
||||||
|
deliver_notification.apply(args=[str(recipient.id)], throw=True)
|
||||||
|
self.assertEqual(post.call_count, 1)
|
||||||
|
self.assertEqual(post.call_args.kwargs["params"], {"user_id": 4})
|
||||||
|
self.assertEqual(post.call_args.kwargs["json"]["chat_id"], 15)
|
||||||
|
self.assertEqual(post.call_args.kwargs["headers"]["Authorization"], "token")
|
||||||
|
self.assertEqual(post.call_args.kwargs["timeout"], MAX_API_TIMEOUT)
|
||||||
|
self.assertIn("Body", post.call_args.kwargs["json"]["text"])
|
||||||
|
recipient.refresh_from_db()
|
||||||
|
self.assertEqual(recipient.delivery_status, DeliveryStatus.SENT)
|
||||||
|
|
||||||
|
def test_max_without_user_id_uses_chat_id(self):
|
||||||
|
recipient = self._max_recipient()
|
||||||
|
response = requests.Response()
|
||||||
|
response.status_code = 200
|
||||||
|
with patch("notify.delivery.providers.max.requests.post", return_value=response) as post:
|
||||||
|
deliver_notification.apply(args=[str(recipient.id)], throw=True)
|
||||||
|
self.assertEqual(post.call_args.kwargs["params"], {"chat_id": -10})
|
||||||
|
recipient.refresh_from_db()
|
||||||
|
self.assertEqual(recipient.delivery_status, DeliveryStatus.SENT)
|
||||||
|
|
||||||
|
def test_max_without_chat_id_is_permanent(self):
|
||||||
|
recipient = self._max_recipient({})
|
||||||
|
with patch("notify.delivery.providers.max.requests.post") as post:
|
||||||
|
deliver_notification.apply(args=[str(recipient.id)], throw=True)
|
||||||
|
post.assert_not_called()
|
||||||
|
recipient.refresh_from_db()
|
||||||
|
self.assertEqual(recipient.delivery_status, DeliveryStatus.FAILED)
|
||||||
|
|
||||||
|
def test_missing_max_config_is_retried(self):
|
||||||
|
notification = Notification.objects.create(verb="Hello", description="Body")
|
||||||
|
recipient = NotificationRecipient.objects.create(
|
||||||
|
notification=notification,
|
||||||
|
user=self.user,
|
||||||
|
delivery_channel=DeliveryChannel.MAX,
|
||||||
|
delivery_target={"chat_id": -10},
|
||||||
|
)
|
||||||
|
result = deliver_notification.apply(args=[str(recipient.id)], throw=False)
|
||||||
|
self.assertEqual(result.state, "FAILURE")
|
||||||
|
recipient.refresh_from_db()
|
||||||
|
self.assertEqual(recipient.delivery_status, DeliveryStatus.FAILED)
|
||||||
|
|
||||||
|
def test_max_timeout_is_retried(self):
|
||||||
|
recipient = self._max_recipient()
|
||||||
|
with patch(
|
||||||
|
"notify.delivery.providers.max.requests.post",
|
||||||
|
side_effect=requests.Timeout(),
|
||||||
|
) as post:
|
||||||
|
result = deliver_notification.apply(args=[str(recipient.id)], throw=False)
|
||||||
|
self.assertEqual(result.state, "FAILURE")
|
||||||
|
self.assertEqual(post.call_count, 6)
|
||||||
|
recipient.refresh_from_db()
|
||||||
|
self.assertEqual(recipient.delivery_status, DeliveryStatus.FAILED)
|
||||||
|
|
||||||
|
def test_max_network_error_is_retried(self):
|
||||||
|
recipient = self._max_recipient()
|
||||||
|
with patch(
|
||||||
|
"notify.delivery.providers.max.requests.post",
|
||||||
|
side_effect=requests.ConnectionError("down"),
|
||||||
|
) as post:
|
||||||
|
result = deliver_notification.apply(args=[str(recipient.id)], throw=False)
|
||||||
|
self.assertEqual(result.state, "FAILURE")
|
||||||
|
self.assertEqual(post.call_count, 6)
|
||||||
|
recipient.refresh_from_db()
|
||||||
|
self.assertEqual(recipient.delivery_status, DeliveryStatus.FAILED)
|
||||||
|
|
||||||
|
def test_telegram_message_is_sent_and_marked(self):
|
||||||
|
DeliveryTokenConfig.objects.create(
|
||||||
|
name="telegram",
|
||||||
|
channel=DeliveryChannel.TELEGRAM,
|
||||||
|
is_default=True,
|
||||||
|
token="bot-token",
|
||||||
|
)
|
||||||
|
notification = create_notification(
|
||||||
|
verb="Hello",
|
||||||
|
description="Body",
|
||||||
|
recipients=[
|
||||||
|
{
|
||||||
|
"user": self.user,
|
||||||
|
"channels": [{"channel": DeliveryChannel.TELEGRAM, "target": {"chat_id": 42}}],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
recipient = notification.recipients.get()
|
||||||
|
response = requests.Response()
|
||||||
|
response.status_code = 200
|
||||||
|
with patch("notify.delivery.providers.telegram.requests.post", return_value=response) as post:
|
||||||
|
deliver_notification.apply(args=[str(recipient.id)], throw=True)
|
||||||
|
self.assertEqual(post.call_count, 1)
|
||||||
|
self.assertEqual(
|
||||||
|
post.call_args.args[0],
|
||||||
|
"https://api.telegram.org/botbot-token/sendMessage",
|
||||||
|
)
|
||||||
|
self.assertEqual(post.call_args.kwargs["json"]["chat_id"], 42)
|
||||||
|
self.assertIn("Body", post.call_args.kwargs["json"]["text"])
|
||||||
|
self.assertEqual(post.call_args.kwargs["timeout"], TELEGRAM_API_TIMEOUT)
|
||||||
|
recipient.refresh_from_db()
|
||||||
|
self.assertEqual(recipient.delivery_status, DeliveryStatus.SENT)
|
||||||
|
self.assertEqual(recipient.attempts, 1)
|
||||||
|
|
||||||
|
def test_telegram_requires_target(self):
|
||||||
|
with self.assertRaisesMessage(ValueError, "target is required"):
|
||||||
|
create_notification(
|
||||||
|
verb="Hi",
|
||||||
|
recipients=[
|
||||||
|
{"user": self.user, "channels": [{"channel": DeliveryChannel.TELEGRAM}]},
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(Notification.objects.count(), 0)
|
||||||
|
|
||||||
|
def test_telegram_client_error_is_not_retried(self):
|
||||||
|
DeliveryTokenConfig.objects.create(
|
||||||
|
name="telegram",
|
||||||
|
channel=DeliveryChannel.TELEGRAM,
|
||||||
|
is_default=True,
|
||||||
|
token="bot-token",
|
||||||
|
)
|
||||||
|
notification = Notification.objects.create(verb="Hello", description="Body")
|
||||||
|
recipient = NotificationRecipient.objects.create(
|
||||||
|
notification=notification,
|
||||||
|
user=self.user,
|
||||||
|
delivery_channel=DeliveryChannel.TELEGRAM,
|
||||||
|
delivery_target={"chat_id": 42},
|
||||||
|
)
|
||||||
|
response = requests.Response()
|
||||||
|
response.status_code = 400
|
||||||
|
error = requests.HTTPError("bad request")
|
||||||
|
error.response = response
|
||||||
|
with patch("notify.delivery.providers.telegram.requests.post") as post:
|
||||||
|
post.return_value.raise_for_status.side_effect = error
|
||||||
|
deliver_notification.apply(args=[str(recipient.id)], throw=True)
|
||||||
|
self.assertEqual(post.call_count, 1)
|
||||||
|
recipient.refresh_from_db()
|
||||||
|
self.assertEqual(recipient.delivery_status, DeliveryStatus.FAILED)
|
||||||
|
self.assertEqual(recipient.attempts, 1)
|
||||||
|
self.assertIn("400", recipient.last_error)
|
||||||
|
|
||||||
|
def test_telegram_timeout_is_retried(self):
|
||||||
|
DeliveryTokenConfig.objects.create(
|
||||||
|
name="telegram",
|
||||||
|
channel=DeliveryChannel.TELEGRAM,
|
||||||
|
is_default=True,
|
||||||
|
token="bot-token",
|
||||||
|
)
|
||||||
|
notification = Notification.objects.create(verb="Hello", description="Body")
|
||||||
|
recipient = NotificationRecipient.objects.create(
|
||||||
|
notification=notification,
|
||||||
|
user=self.user,
|
||||||
|
delivery_channel=DeliveryChannel.TELEGRAM,
|
||||||
|
delivery_target={"chat_id": 42},
|
||||||
|
)
|
||||||
|
with patch(
|
||||||
|
"notify.delivery.providers.telegram.requests.post",
|
||||||
|
side_effect=requests.Timeout(),
|
||||||
|
) as post:
|
||||||
|
result = deliver_notification.apply(args=[str(recipient.id)], throw=False)
|
||||||
|
self.assertEqual(result.state, "FAILURE")
|
||||||
|
self.assertEqual(post.call_count, 6)
|
||||||
|
recipient.refresh_from_db()
|
||||||
|
self.assertEqual(recipient.delivery_status, DeliveryStatus.FAILED)
|
||||||
|
self.assertEqual(recipient.attempts, 6)
|
||||||
|
|
||||||
|
def test_markdown_filter_renders_fenced_code(self):
|
||||||
|
rendered = render("{{ text | markdown }}", {"text": "```\nprint(1)\n```"})
|
||||||
|
self.assertIn("<code>", rendered)
|
||||||
|
self.assertIn("print(1)", rendered)
|
||||||
|
|
@ -0,0 +1,282 @@
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from django.core.exceptions import ValidationError
|
||||||
|
from django.db.models import ProtectedError
|
||||||
|
from django.test import TestCase
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
|
from notify.models.delivery import EMAIL_TIMEOUT
|
||||||
|
from notify.models import (
|
||||||
|
DeliveryChannel,
|
||||||
|
DeliveryEmailConfig,
|
||||||
|
DeliveryTokenConfig,
|
||||||
|
DeliveryStatus,
|
||||||
|
Notification,
|
||||||
|
NotificationGroup,
|
||||||
|
NotificationRecipient,
|
||||||
|
NotificationTemplate,
|
||||||
|
NotificationType,
|
||||||
|
validate_delivery_channels,
|
||||||
|
)
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
class ModelTests(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.user = User.objects.create_user("alice", "alice@example.com", "pass")
|
||||||
|
|
||||||
|
def test_channel_validator(self):
|
||||||
|
validate_delivery_channels(["email", "browser"])
|
||||||
|
with self.assertRaises(ValidationError):
|
||||||
|
validate_delivery_channels("email")
|
||||||
|
with self.assertRaises(ValidationError):
|
||||||
|
validate_delivery_channels(["sms"])
|
||||||
|
|
||||||
|
def test_type_rejects_unknown_channels(self):
|
||||||
|
group = NotificationGroup.objects.create(code="g", name="G")
|
||||||
|
kind = NotificationType(code="t", name="T", group=group, channels=["sms"])
|
||||||
|
with self.assertRaises(ValidationError):
|
||||||
|
kind.full_clean()
|
||||||
|
|
||||||
|
def test_natural_keys(self):
|
||||||
|
group = NotificationGroup.objects.create(code="orders", name="Orders")
|
||||||
|
kind = NotificationType.objects.create(
|
||||||
|
code="approved",
|
||||||
|
name="Approved",
|
||||||
|
group=group,
|
||||||
|
)
|
||||||
|
self.assertEqual(group.natural_key(), ("orders",))
|
||||||
|
self.assertEqual(NotificationGroup.objects.get_by_natural_key("orders"), group)
|
||||||
|
self.assertEqual(kind.natural_key(), ("approved",))
|
||||||
|
self.assertEqual(NotificationType.objects.get_by_natural_key("approved"), kind)
|
||||||
|
self.assertEqual(str(group), "Orders")
|
||||||
|
self.assertEqual(str(kind), "Approved")
|
||||||
|
|
||||||
|
def test_group_cannot_be_deleted_while_a_type_exists(self):
|
||||||
|
group = NotificationGroup.objects.create(code="orders", name="Orders")
|
||||||
|
NotificationType.objects.create(code="approved", name="Approved", group=group)
|
||||||
|
with self.assertRaises(ProtectedError):
|
||||||
|
group.delete()
|
||||||
|
|
||||||
|
def test_records_are_ordered(self):
|
||||||
|
NotificationGroup.objects.create(code="b", name="B")
|
||||||
|
NotificationGroup.objects.create(code="a", name="A")
|
||||||
|
self.assertEqual(
|
||||||
|
list(NotificationGroup.objects.values_list("code", flat=True)),
|
||||||
|
["a", "b"],
|
||||||
|
)
|
||||||
|
group = NotificationGroup.objects.get(code="a")
|
||||||
|
NotificationType.objects.create(code="b", name="B", group=group, position=2)
|
||||||
|
NotificationType.objects.create(code="a", name="A", group=group, position=2)
|
||||||
|
NotificationType.objects.create(code="c", name="C", group=group, position=1)
|
||||||
|
self.assertEqual(
|
||||||
|
list(NotificationType.objects.values_list("code", flat=True)),
|
||||||
|
["c", "a", "b"],
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_relative_url_keeps_only_the_path(self):
|
||||||
|
note = Notification(verb="Hi", url="https://example.com/orders/1?x=1")
|
||||||
|
self.assertEqual(note.relative_url, "/orders/1")
|
||||||
|
note.url = "/inbox"
|
||||||
|
self.assertEqual(note.relative_url, "/inbox")
|
||||||
|
note.url = None
|
||||||
|
self.assertIsNone(note.relative_url)
|
||||||
|
self.assertEqual(str(note), "Hi")
|
||||||
|
|
||||||
|
def test_default_expiry_is_about_thirty_days(self):
|
||||||
|
note = Notification.objects.create(verb="Hi")
|
||||||
|
remaining = note.expires_at - timezone.now()
|
||||||
|
self.assertGreater(remaining, timedelta(days=29))
|
||||||
|
self.assertLess(remaining, timedelta(days=31))
|
||||||
|
|
||||||
|
def test_browser_recipient_is_sent_on_save(self):
|
||||||
|
note = Notification.objects.create(verb="Hi")
|
||||||
|
recipient = NotificationRecipient.objects.create(
|
||||||
|
notification=note,
|
||||||
|
user=self.user,
|
||||||
|
delivery_channel=DeliveryChannel.BROWSER,
|
||||||
|
delivery_status=DeliveryStatus.UNSENT,
|
||||||
|
)
|
||||||
|
self.assertEqual(recipient.delivery_status, DeliveryStatus.SENT)
|
||||||
|
self.assertEqual(str(recipient), f"{DeliveryChannel.BROWSER} ({DeliveryStatus.SENT})")
|
||||||
|
|
||||||
|
def test_read_flags(self):
|
||||||
|
note = Notification.objects.create(verb="Hi")
|
||||||
|
recipient = NotificationRecipient.objects.create(
|
||||||
|
notification=note,
|
||||||
|
user=self.user,
|
||||||
|
delivery_channel=DeliveryChannel.EMAIL,
|
||||||
|
delivery_target={"email": "alice@example.com"},
|
||||||
|
)
|
||||||
|
self.assertIn("alice@example.com", str(recipient))
|
||||||
|
recipient.make_read()
|
||||||
|
recipient.refresh_from_db()
|
||||||
|
self.assertFalse(recipient.unread)
|
||||||
|
self.assertEqual(recipient.delivery_status, DeliveryStatus.UNSENT)
|
||||||
|
recipient.make_unread()
|
||||||
|
recipient.refresh_from_db()
|
||||||
|
self.assertTrue(recipient.unread)
|
||||||
|
|
||||||
|
def test_only_one_default_template_per_channel(self):
|
||||||
|
first = NotificationTemplate.objects.create(
|
||||||
|
channel=DeliveryChannel.EMAIL,
|
||||||
|
name="first",
|
||||||
|
is_default=True,
|
||||||
|
body_template="A",
|
||||||
|
)
|
||||||
|
second = NotificationTemplate.objects.create(
|
||||||
|
channel=DeliveryChannel.EMAIL,
|
||||||
|
name="second",
|
||||||
|
is_default=True,
|
||||||
|
body_template="B",
|
||||||
|
)
|
||||||
|
first.refresh_from_db()
|
||||||
|
self.assertFalse(first.is_default)
|
||||||
|
self.assertEqual(NotificationTemplate.default(DeliveryChannel.EMAIL).pk, second.pk)
|
||||||
|
self.assertIsNone(NotificationTemplate.default(DeliveryChannel.MAX))
|
||||||
|
|
||||||
|
def test_typed_template_does_not_replace_the_channel_default(self):
|
||||||
|
group = NotificationGroup.objects.create(code="orders", name="Orders")
|
||||||
|
kind = NotificationType.objects.create(code="approved", name="Approved", group=group)
|
||||||
|
fallback = NotificationTemplate.objects.create(
|
||||||
|
channel=DeliveryChannel.EMAIL,
|
||||||
|
name="fallback",
|
||||||
|
is_default=True,
|
||||||
|
body_template="FALLBACK",
|
||||||
|
)
|
||||||
|
typed = NotificationTemplate.objects.create(
|
||||||
|
channel=DeliveryChannel.EMAIL,
|
||||||
|
type=kind,
|
||||||
|
name="approved-email",
|
||||||
|
is_default=True,
|
||||||
|
body_template="TYPED",
|
||||||
|
)
|
||||||
|
fallback.refresh_from_db()
|
||||||
|
self.assertTrue(fallback.is_default)
|
||||||
|
self.assertEqual(NotificationTemplate.default(DeliveryChannel.EMAIL).pk, fallback.pk)
|
||||||
|
self.assertEqual(NotificationTemplate.for_delivery(DeliveryChannel.EMAIL, kind).pk, typed.pk)
|
||||||
|
self.assertEqual(
|
||||||
|
NotificationTemplate.for_delivery(DeliveryChannel.EMAIL, None).pk,
|
||||||
|
fallback.pk,
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_template_render(self):
|
||||||
|
template = NotificationTemplate(
|
||||||
|
channel=DeliveryChannel.EMAIL,
|
||||||
|
name="t",
|
||||||
|
subject_template="Hello {{ user.username }}",
|
||||||
|
body_template="{{ notification.verb }}",
|
||||||
|
)
|
||||||
|
context = {"user": {"username": "alice"}, "notification": {"verb": "Go"}}
|
||||||
|
self.assertEqual(template.render_subject(context), "Hello alice")
|
||||||
|
self.assertEqual(template.render_body(context), "Go")
|
||||||
|
self.assertEqual(str(template), "t")
|
||||||
|
|
||||||
|
def test_template_render_escapes_html(self):
|
||||||
|
template = NotificationTemplate(
|
||||||
|
channel=DeliveryChannel.EMAIL,
|
||||||
|
name="t",
|
||||||
|
body_template="{{ notification.verb }}",
|
||||||
|
)
|
||||||
|
rendered = template.render_body({"notification": {"verb": "<script>alert(1)</script>"}})
|
||||||
|
self.assertNotIn("<script>", rendered)
|
||||||
|
self.assertIn("<script>", rendered)
|
||||||
|
|
||||||
|
def test_template_render_missing_field_is_empty(self):
|
||||||
|
template = NotificationTemplate(
|
||||||
|
channel=DeliveryChannel.EMAIL,
|
||||||
|
name="t",
|
||||||
|
body_template="[{{ notification.url }}]",
|
||||||
|
)
|
||||||
|
self.assertEqual(template.render_body({"notification": {}}), "[]")
|
||||||
|
|
||||||
|
def test_saving_unrelated_fields_keeps_the_default(self):
|
||||||
|
first = DeliveryEmailConfig.objects.create(
|
||||||
|
name="first",
|
||||||
|
channel=DeliveryChannel.EMAIL,
|
||||||
|
is_default=True,
|
||||||
|
host="smtp.example.com",
|
||||||
|
use_ssl=False,
|
||||||
|
use_tls=True,
|
||||||
|
)
|
||||||
|
second = DeliveryEmailConfig.objects.create(
|
||||||
|
name="second",
|
||||||
|
channel=DeliveryChannel.EMAIL,
|
||||||
|
is_default=False,
|
||||||
|
host="smtp.other.example.com",
|
||||||
|
use_ssl=False,
|
||||||
|
use_tls=True,
|
||||||
|
)
|
||||||
|
second.host = "smtp.changed.example.com"
|
||||||
|
second.save(update_fields=["host"])
|
||||||
|
first.refresh_from_db()
|
||||||
|
second.refresh_from_db()
|
||||||
|
self.assertTrue(first.is_default)
|
||||||
|
self.assertFalse(second.is_default)
|
||||||
|
self.assertEqual(second.host, "smtp.changed.example.com")
|
||||||
|
|
||||||
|
second.is_default = True
|
||||||
|
second.save(update_fields=["is_default"])
|
||||||
|
first.refresh_from_db()
|
||||||
|
self.assertFalse(first.is_default)
|
||||||
|
self.assertEqual(DeliveryEmailConfig.get_default().pk, second.pk)
|
||||||
|
|
||||||
|
def test_get_default_without_a_row_is_none(self):
|
||||||
|
self.assertIsNone(DeliveryEmailConfig.get_default())
|
||||||
|
|
||||||
|
def test_token_defaults_are_independent_per_channel(self):
|
||||||
|
max_config = DeliveryTokenConfig.objects.create(
|
||||||
|
name="max",
|
||||||
|
channel=DeliveryChannel.MAX,
|
||||||
|
is_default=True,
|
||||||
|
token="max-token",
|
||||||
|
)
|
||||||
|
telegram_config = DeliveryTokenConfig.objects.create(
|
||||||
|
name="telegram",
|
||||||
|
channel=DeliveryChannel.TELEGRAM,
|
||||||
|
is_default=True,
|
||||||
|
token="telegram-token",
|
||||||
|
)
|
||||||
|
self.assertEqual(DeliveryTokenConfig.get_default(DeliveryChannel.MAX).pk, max_config.pk)
|
||||||
|
self.assertEqual(
|
||||||
|
DeliveryTokenConfig.get_default(DeliveryChannel.TELEGRAM).pk,
|
||||||
|
telegram_config.pk,
|
||||||
|
)
|
||||||
|
replacement = DeliveryTokenConfig.objects.create(
|
||||||
|
name="max-2",
|
||||||
|
channel=DeliveryChannel.MAX,
|
||||||
|
is_default=True,
|
||||||
|
token="next",
|
||||||
|
)
|
||||||
|
max_config.refresh_from_db()
|
||||||
|
telegram_config.refresh_from_db()
|
||||||
|
self.assertFalse(max_config.is_default)
|
||||||
|
self.assertTrue(telegram_config.is_default)
|
||||||
|
self.assertEqual(DeliveryTokenConfig.get_default(DeliveryChannel.MAX).pk, replacement.pk)
|
||||||
|
|
||||||
|
def test_connection_config(self):
|
||||||
|
config = DeliveryEmailConfig(
|
||||||
|
name="smtp",
|
||||||
|
channel=DeliveryChannel.EMAIL,
|
||||||
|
host="smtp.example.com",
|
||||||
|
port=2525,
|
||||||
|
username="mailbox",
|
||||||
|
password="secret",
|
||||||
|
use_ssl=False,
|
||||||
|
use_tls=True,
|
||||||
|
)
|
||||||
|
self.assertEqual(str(config), "mailbox (smtp.example.com)")
|
||||||
|
self.assertEqual(
|
||||||
|
config.get_connection_config(),
|
||||||
|
{
|
||||||
|
"host": "smtp.example.com",
|
||||||
|
"port": 2525,
|
||||||
|
"username": "mailbox",
|
||||||
|
"password": "secret",
|
||||||
|
"use_ssl": False,
|
||||||
|
"use_tls": True,
|
||||||
|
"timeout": EMAIL_TIMEOUT,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,601 @@
|
||||||
|
from datetime import timedelta
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from django.core import mail
|
||||||
|
from django.test import TestCase
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
|
from notify.models import (
|
||||||
|
DeliveryChannel,
|
||||||
|
DeliveryStatus,
|
||||||
|
Notification,
|
||||||
|
NotificationChannelPreference,
|
||||||
|
NotificationGroup,
|
||||||
|
NotificationLevel,
|
||||||
|
NotificationRecipient,
|
||||||
|
NotificationType,
|
||||||
|
)
|
||||||
|
from notify.services import channel_preferences, create_notification, save_channel_preferences
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
class CreateNotificationTests(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.user = User.objects.create_user("alice", "alice@example.com", "pass")
|
||||||
|
self.other = User.objects.create_user("bob", "bob@example.com", "pass")
|
||||||
|
self.group = NotificationGroup.objects.create(code="orders", name="Orders")
|
||||||
|
self.kind = NotificationType.objects.create(
|
||||||
|
code="approved",
|
||||||
|
name="Approved",
|
||||||
|
group=self.group,
|
||||||
|
channels=[DeliveryChannel.EMAIL, DeliveryChannel.BROWSER, DeliveryChannel.MAX],
|
||||||
|
verb="Approved",
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_type_supplies_the_verb_and_links_the_row(self):
|
||||||
|
notification = create_notification(
|
||||||
|
type=self.kind,
|
||||||
|
recipients=[
|
||||||
|
{"user": self.user, "channels": [{"channel": DeliveryChannel.BROWSER}]},
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(notification.verb, "Approved")
|
||||||
|
self.assertEqual(notification.type, self.kind)
|
||||||
|
self.assertEqual(notification.level, NotificationLevel.INFO)
|
||||||
|
self.assertEqual(notification.data, {})
|
||||||
|
self.assertEqual(notification.object_id, "")
|
||||||
|
recipient = notification.recipients.get()
|
||||||
|
self.assertEqual(recipient.delivery_status, DeliveryStatus.SENT)
|
||||||
|
self.assertTrue(recipient.unread)
|
||||||
|
|
||||||
|
def test_code_resolves_to_the_same_type(self):
|
||||||
|
notification = create_notification(
|
||||||
|
type="approved",
|
||||||
|
recipients=[
|
||||||
|
{"user": self.user, "channels": [{"channel": DeliveryChannel.BROWSER}]},
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(notification.type, self.kind)
|
||||||
|
self.assertEqual(notification.verb, "Approved")
|
||||||
|
|
||||||
|
def test_explicit_fields_override_the_type(self):
|
||||||
|
when = timezone.now() + timedelta(days=2)
|
||||||
|
notification = create_notification(
|
||||||
|
type="approved",
|
||||||
|
verb="Custom",
|
||||||
|
url="https://example.com/orders/9?x=1",
|
||||||
|
level=NotificationLevel.ERROR,
|
||||||
|
object_id="9",
|
||||||
|
description="Done",
|
||||||
|
data={"n": 1},
|
||||||
|
expires_at=when,
|
||||||
|
recipients=[
|
||||||
|
{"user": self.user, "channels": [{"channel": DeliveryChannel.BROWSER}]},
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(notification.verb, "Custom")
|
||||||
|
self.assertEqual(notification.url, "https://example.com/orders/9?x=1")
|
||||||
|
self.assertEqual(notification.relative_url, "/orders/9")
|
||||||
|
self.assertEqual(notification.level, NotificationLevel.ERROR)
|
||||||
|
self.assertEqual(notification.object_id, "9")
|
||||||
|
self.assertEqual(notification.description, "Done")
|
||||||
|
self.assertEqual(notification.data, {"n": 1})
|
||||||
|
self.assertEqual(notification.expires_at, when)
|
||||||
|
|
||||||
|
def test_verb_is_required(self):
|
||||||
|
self.kind.verb = ""
|
||||||
|
self.kind.save(update_fields=["verb"])
|
||||||
|
with self.assertRaisesMessage(ValueError, "verb is required"):
|
||||||
|
create_notification(
|
||||||
|
type="approved",
|
||||||
|
recipients=[
|
||||||
|
{"user": self.user, "channels": [{"channel": DeliveryChannel.BROWSER}]},
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(Notification.objects.count(), 0)
|
||||||
|
|
||||||
|
def test_unknown_type_creates_nothing(self):
|
||||||
|
with self.assertRaises(NotificationType.DoesNotExist):
|
||||||
|
create_notification(
|
||||||
|
type="missing",
|
||||||
|
verb="Hi",
|
||||||
|
recipients=[
|
||||||
|
{"user": self.user, "channels": [{"channel": DeliveryChannel.BROWSER}]},
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(Notification.objects.count(), 0)
|
||||||
|
|
||||||
|
def test_empty_recipient_list_is_rejected(self):
|
||||||
|
with self.assertRaisesMessage(ValueError, "At least one recipient"):
|
||||||
|
create_notification(verb="Hi", recipients=[])
|
||||||
|
self.assertEqual(Notification.objects.count(), 0)
|
||||||
|
|
||||||
|
def test_recipient_without_channels_rolls_back(self):
|
||||||
|
with self.assertRaisesMessage(ValueError, "no channels"):
|
||||||
|
create_notification(
|
||||||
|
verb="Hi",
|
||||||
|
recipients=[
|
||||||
|
{"user": self.user, "channels": [{"channel": DeliveryChannel.BROWSER}]},
|
||||||
|
{"user": self.other, "channels": []},
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(Notification.objects.count(), 0)
|
||||||
|
self.assertEqual(NotificationRecipient.objects.count(), 0)
|
||||||
|
|
||||||
|
def test_same_user_and_channel_twice_rolls_back(self):
|
||||||
|
with self.assertRaisesMessage(ValueError, "Duplicate"):
|
||||||
|
create_notification(
|
||||||
|
verb="Hi",
|
||||||
|
recipients=[
|
||||||
|
{"user": self.user, "channels": [{"channel": DeliveryChannel.BROWSER}]},
|
||||||
|
{"user": self.user, "channels": [{"channel": DeliveryChannel.BROWSER}]},
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(Notification.objects.count(), 0)
|
||||||
|
|
||||||
|
def test_each_user_gets_a_recipient(self):
|
||||||
|
notification = create_notification(
|
||||||
|
verb="Hi",
|
||||||
|
recipients=[
|
||||||
|
{"user": self.user, "channels": [{"channel": DeliveryChannel.BROWSER}]},
|
||||||
|
{"user": self.other, "channels": [{"channel": DeliveryChannel.BROWSER}]},
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
set(notification.recipients.values_list("user_id", flat=True)),
|
||||||
|
{self.user.pk, self.other.pk},
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_invalid_email_rolls_back(self):
|
||||||
|
with self.assertRaisesMessage(ValueError, "valid email"):
|
||||||
|
create_notification(
|
||||||
|
verb="Hi",
|
||||||
|
recipients=[
|
||||||
|
{
|
||||||
|
"user": self.user,
|
||||||
|
"channels": [
|
||||||
|
{"channel": DeliveryChannel.BROWSER},
|
||||||
|
{"channel": DeliveryChannel.EMAIL, "target": {"email": "not-an-email"}},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(Notification.objects.count(), 0)
|
||||||
|
self.assertEqual(NotificationRecipient.objects.count(), 0)
|
||||||
|
|
||||||
|
def test_blank_email_is_rejected(self):
|
||||||
|
with self.assertRaisesMessage(ValueError, "valid email"):
|
||||||
|
create_notification(
|
||||||
|
verb="Hi",
|
||||||
|
recipients=[
|
||||||
|
{
|
||||||
|
"user": self.user,
|
||||||
|
"channels": [{"channel": DeliveryChannel.EMAIL, "target": {"email": " "}}],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(Notification.objects.count(), 0)
|
||||||
|
|
||||||
|
def test_email_requires_target(self):
|
||||||
|
with self.assertRaisesMessage(ValueError, "target is required"):
|
||||||
|
create_notification(
|
||||||
|
verb="Hi",
|
||||||
|
recipients=[
|
||||||
|
{"user": self.user, "channels": [{"channel": DeliveryChannel.EMAIL}]},
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(Notification.objects.count(), 0)
|
||||||
|
|
||||||
|
def test_email_target_is_stored(self):
|
||||||
|
notification = create_notification(
|
||||||
|
verb="Hi",
|
||||||
|
recipients=[
|
||||||
|
{
|
||||||
|
"user": self.user,
|
||||||
|
"channels": [{"channel": DeliveryChannel.EMAIL, "target": {"email": "alice@example.com"}}],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(notification.recipients.get().delivery_target, {"email": "alice@example.com"})
|
||||||
|
|
||||||
|
def test_browser_rejects_target(self):
|
||||||
|
with self.assertRaisesMessage(ValueError, "target is not supported"):
|
||||||
|
create_notification(
|
||||||
|
verb="Hi",
|
||||||
|
recipients=[
|
||||||
|
{
|
||||||
|
"user": self.user,
|
||||||
|
"channels": [{"channel": DeliveryChannel.BROWSER, "target": {"chat_id": 1}}],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(Notification.objects.count(), 0)
|
||||||
|
|
||||||
|
def test_max_chat_is_stored(self):
|
||||||
|
notification = create_notification(
|
||||||
|
verb="Hi",
|
||||||
|
recipients=[
|
||||||
|
{
|
||||||
|
"user": self.user,
|
||||||
|
"channels": [{"channel": DeliveryChannel.MAX, "target": {"chat_id": -5}}],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
notification.recipients.get().delivery_target,
|
||||||
|
{"chat_id": -5, "user_id": None},
|
||||||
|
)
|
||||||
|
self.assertEqual(notification.recipients.get().delivery_status, DeliveryStatus.UNSENT)
|
||||||
|
|
||||||
|
def test_max_user_and_chat_are_stored(self):
|
||||||
|
notification = create_notification(
|
||||||
|
verb="Hi",
|
||||||
|
recipients=[
|
||||||
|
{
|
||||||
|
"user": self.other,
|
||||||
|
"channels": [
|
||||||
|
{
|
||||||
|
"channel": DeliveryChannel.MAX,
|
||||||
|
"target": {"chat_id": 3, "user_id": 8},
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
notification.recipients.get().delivery_target,
|
||||||
|
{"chat_id": 3, "user_id": 8},
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_max_requires_target(self):
|
||||||
|
with self.assertRaisesMessage(ValueError, "target is required"):
|
||||||
|
create_notification(
|
||||||
|
verb="Hi",
|
||||||
|
recipients=[
|
||||||
|
{"user": self.user, "channels": [{"channel": DeliveryChannel.MAX}]},
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(Notification.objects.count(), 0)
|
||||||
|
|
||||||
|
def test_max_rejects_a_positive_chat_without_user(self):
|
||||||
|
with self.assertRaisesMessage(ValueError, "negative"):
|
||||||
|
create_notification(
|
||||||
|
verb="Hi",
|
||||||
|
recipients=[
|
||||||
|
{
|
||||||
|
"user": self.user,
|
||||||
|
"channels": [{"channel": DeliveryChannel.MAX, "target": {"chat_id": 5}}],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(Notification.objects.count(), 0)
|
||||||
|
|
||||||
|
def test_max_rejects_a_non_positive_pair(self):
|
||||||
|
with self.assertRaisesMessage(ValueError, "positive"):
|
||||||
|
create_notification(
|
||||||
|
verb="Hi",
|
||||||
|
recipients=[
|
||||||
|
{
|
||||||
|
"user": self.user,
|
||||||
|
"channels": [
|
||||||
|
{
|
||||||
|
"channel": DeliveryChannel.MAX,
|
||||||
|
"target": {"chat_id": -1, "user_id": 2},
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(Notification.objects.count(), 0)
|
||||||
|
|
||||||
|
|
||||||
|
class DeliveryEnqueueTests(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.user = User.objects.create_user("alice", "alice@example.com", "pass")
|
||||||
|
|
||||||
|
def test_async_channels_are_enqueued_after_commit(self):
|
||||||
|
with patch("notify.tasks.deliver_notification.apply_async") as apply_async:
|
||||||
|
with self.captureOnCommitCallbacks(execute=True):
|
||||||
|
notification = create_notification(
|
||||||
|
verb="Hi",
|
||||||
|
recipients=[
|
||||||
|
{
|
||||||
|
"user": self.user,
|
||||||
|
"channels": [
|
||||||
|
{
|
||||||
|
"channel": DeliveryChannel.EMAIL,
|
||||||
|
"target": {"email": "alice@example.com"},
|
||||||
|
},
|
||||||
|
{"channel": DeliveryChannel.BROWSER},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
email = notification.recipients.get(delivery_channel=DeliveryChannel.EMAIL)
|
||||||
|
browser = notification.recipients.get(delivery_channel=DeliveryChannel.BROWSER)
|
||||||
|
self.assertEqual(email.delivery_status, DeliveryStatus.UNSENT)
|
||||||
|
self.assertEqual(browser.delivery_status, DeliveryStatus.SENT)
|
||||||
|
apply_async.assert_called_once_with(args=(str(email.id),))
|
||||||
|
self.assertEqual(len(mail.outbox), 0)
|
||||||
|
|
||||||
|
def test_browser_channel_is_not_enqueued(self):
|
||||||
|
with patch("notify.tasks.deliver_notification.apply_async") as apply_async:
|
||||||
|
with self.captureOnCommitCallbacks(execute=True):
|
||||||
|
create_notification(
|
||||||
|
verb="Hi",
|
||||||
|
recipients=[
|
||||||
|
{"user": self.user, "channels": [{"channel": DeliveryChannel.BROWSER}]},
|
||||||
|
],
|
||||||
|
)
|
||||||
|
apply_async.assert_not_called()
|
||||||
|
|
||||||
|
def test_failed_create_does_not_enqueue(self):
|
||||||
|
with patch("notify.tasks.deliver_notification.apply_async") as apply_async:
|
||||||
|
with self.captureOnCommitCallbacks(execute=True):
|
||||||
|
with self.assertRaisesMessage(ValueError, "Duplicate"):
|
||||||
|
create_notification(
|
||||||
|
verb="Hi",
|
||||||
|
recipients=[
|
||||||
|
{
|
||||||
|
"user": self.user,
|
||||||
|
"channels": [
|
||||||
|
{
|
||||||
|
"channel": DeliveryChannel.EMAIL,
|
||||||
|
"target": {"email": "alice@example.com"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"channel": DeliveryChannel.EMAIL,
|
||||||
|
"target": {"email": "alice@example.com"},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
apply_async.assert_not_called()
|
||||||
|
self.assertEqual(Notification.objects.count(), 0)
|
||||||
|
|
||||||
|
|
||||||
|
class ChannelPreferenceTests(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.user = User.objects.create_user("alice", "alice@example.com", "pass")
|
||||||
|
self.other = User.objects.create_user("bob", "bob@example.com", "pass")
|
||||||
|
self.group = NotificationGroup.objects.create(code="orders", name="Orders")
|
||||||
|
self.kind = NotificationType.objects.create(
|
||||||
|
code="approved",
|
||||||
|
name="Approved",
|
||||||
|
group=self.group,
|
||||||
|
channels=[DeliveryChannel.EMAIL, DeliveryChannel.BROWSER],
|
||||||
|
verb="Approved",
|
||||||
|
can_switch=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_disabled_channel_is_omitted_and_an_empty_result_rolls_back(self):
|
||||||
|
NotificationChannelPreference.objects.create(
|
||||||
|
user=self.user,
|
||||||
|
type=self.kind,
|
||||||
|
channel=DeliveryChannel.EMAIL,
|
||||||
|
enabled=False,
|
||||||
|
)
|
||||||
|
notification = create_notification(
|
||||||
|
type="approved",
|
||||||
|
recipients=[
|
||||||
|
{
|
||||||
|
"user": self.user,
|
||||||
|
"channels": [
|
||||||
|
{"channel": DeliveryChannel.BROWSER},
|
||||||
|
{"channel": DeliveryChannel.EMAIL, "target": {"email": self.user.email}},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
list(notification.recipients.values_list("delivery_channel", flat=True)),
|
||||||
|
[DeliveryChannel.BROWSER],
|
||||||
|
)
|
||||||
|
|
||||||
|
NotificationChannelPreference.objects.create(
|
||||||
|
user=self.user,
|
||||||
|
type=self.kind,
|
||||||
|
channel=DeliveryChannel.BROWSER,
|
||||||
|
enabled=False,
|
||||||
|
)
|
||||||
|
with self.assertRaisesMessage(ValueError, "No recipients to deliver"):
|
||||||
|
create_notification(
|
||||||
|
type="approved",
|
||||||
|
recipients=[
|
||||||
|
{"user": self.user, "channels": [{"channel": DeliveryChannel.BROWSER}]},
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(Notification.objects.count(), 1)
|
||||||
|
|
||||||
|
def test_missing_preference_keeps_the_channel(self):
|
||||||
|
notification = create_notification(
|
||||||
|
type="approved",
|
||||||
|
recipients=[
|
||||||
|
{
|
||||||
|
"user": self.user,
|
||||||
|
"channels": [
|
||||||
|
{"channel": DeliveryChannel.EMAIL, "target": {"email": self.user.email}},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(notification.recipients.get().delivery_channel, DeliveryChannel.EMAIL)
|
||||||
|
|
||||||
|
def test_locked_type_ignores_a_disabled_preference(self):
|
||||||
|
self.kind.can_switch = False
|
||||||
|
self.kind.save(update_fields=["can_switch"])
|
||||||
|
NotificationChannelPreference.objects.create(
|
||||||
|
user=self.user,
|
||||||
|
type=self.kind,
|
||||||
|
channel=DeliveryChannel.EMAIL,
|
||||||
|
enabled=False,
|
||||||
|
)
|
||||||
|
notification = create_notification(
|
||||||
|
type="approved",
|
||||||
|
recipients=[
|
||||||
|
{
|
||||||
|
"user": self.user,
|
||||||
|
"channels": [
|
||||||
|
{"channel": DeliveryChannel.EMAIL, "target": {"email": self.user.email}},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(notification.recipients.get().delivery_channel, DeliveryChannel.EMAIL)
|
||||||
|
|
||||||
|
def test_preference_screen_reads_and_writes_switchable_channels(self):
|
||||||
|
hidden = NotificationType.objects.create(
|
||||||
|
code="security",
|
||||||
|
name="Security",
|
||||||
|
group=self.group,
|
||||||
|
channels=[DeliveryChannel.EMAIL],
|
||||||
|
can_switch=False,
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
channel_preferences(self.user),
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"code": "approved",
|
||||||
|
"channels": [
|
||||||
|
{"channel": DeliveryChannel.EMAIL, "enabled": True},
|
||||||
|
{"channel": DeliveryChannel.BROWSER, "enabled": True},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
save_channel_preferences(
|
||||||
|
self.user,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"code": "approved",
|
||||||
|
"channels": [
|
||||||
|
{"channel": DeliveryChannel.EMAIL, "enabled": False},
|
||||||
|
{"channel": DeliveryChannel.BROWSER, "enabled": True},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertFalse(
|
||||||
|
NotificationChannelPreference.objects.get(
|
||||||
|
user=self.user,
|
||||||
|
type=self.kind,
|
||||||
|
channel=DeliveryChannel.EMAIL,
|
||||||
|
).enabled
|
||||||
|
)
|
||||||
|
self.assertEqual(channel_preferences(self.user)[0]["channels"][0]["enabled"], False)
|
||||||
|
with self.assertRaisesMessage(ValueError, "not allowed"):
|
||||||
|
save_channel_preferences(
|
||||||
|
self.user,
|
||||||
|
[{"code": "approved", "channels": [{"channel": DeliveryChannel.MAX, "enabled": True}]}],
|
||||||
|
)
|
||||||
|
with self.assertRaises(NotificationType.DoesNotExist):
|
||||||
|
save_channel_preferences(
|
||||||
|
self.user,
|
||||||
|
[{"code": hidden.code, "channels": [{"channel": DeliveryChannel.EMAIL, "enabled": False}]}],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class GroupingAndIdempotencyTests(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.user = User.objects.create_user("alice", "alice@example.com", "pass")
|
||||||
|
self.group = NotificationGroup.objects.create(code="posts", name="Posts")
|
||||||
|
self.kind = NotificationType.objects.create(
|
||||||
|
code="comment",
|
||||||
|
name="Comment",
|
||||||
|
group=self.group,
|
||||||
|
channels=[DeliveryChannel.BROWSER, DeliveryChannel.EMAIL],
|
||||||
|
verb="Comment",
|
||||||
|
)
|
||||||
|
|
||||||
|
def _recipients(self):
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
"user": self.user,
|
||||||
|
"channels": [
|
||||||
|
{"channel": DeliveryChannel.BROWSER},
|
||||||
|
{"channel": DeliveryChannel.EMAIL, "target": {"email": self.user.email}},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
def test_group_bumps_the_unread_browser_notification_without_a_new_delivery(self):
|
||||||
|
with patch("notify.tasks.deliver_notification.apply_async") as apply_async:
|
||||||
|
with self.captureOnCommitCallbacks(execute=True):
|
||||||
|
first = create_notification(
|
||||||
|
type=self.kind,
|
||||||
|
object_id="post-9",
|
||||||
|
verb="Новый комментарий",
|
||||||
|
group=True,
|
||||||
|
recipients=self._recipients(),
|
||||||
|
)
|
||||||
|
self.assertEqual(apply_async.call_count, 1)
|
||||||
|
with self.captureOnCommitCallbacks(execute=True):
|
||||||
|
second = create_notification(
|
||||||
|
type=self.kind,
|
||||||
|
object_id="post-9",
|
||||||
|
verb="Ещё комментарий",
|
||||||
|
group=True,
|
||||||
|
recipients=self._recipients(),
|
||||||
|
)
|
||||||
|
self.assertEqual(apply_async.call_count, 1)
|
||||||
|
self.assertEqual(second.pk, first.pk)
|
||||||
|
second.refresh_from_db()
|
||||||
|
self.assertEqual(second.data["count"], 2)
|
||||||
|
self.assertEqual(second.verb, "Ещё комментарий")
|
||||||
|
self.assertEqual(Notification.objects.count(), 1)
|
||||||
|
self.assertEqual(second.recipients.count(), 2)
|
||||||
|
|
||||||
|
def test_group_starts_over_after_the_browser_row_is_read(self):
|
||||||
|
first = create_notification(
|
||||||
|
type=self.kind,
|
||||||
|
object_id="post-9",
|
||||||
|
group=True,
|
||||||
|
recipients=self._recipients(),
|
||||||
|
)
|
||||||
|
first.recipients.filter(delivery_channel=DeliveryChannel.BROWSER).update(unread=False)
|
||||||
|
second = create_notification(
|
||||||
|
type=self.kind,
|
||||||
|
object_id="post-9",
|
||||||
|
group=True,
|
||||||
|
recipients=[{"user": self.user, "channels": [{"channel": DeliveryChannel.BROWSER}]}],
|
||||||
|
)
|
||||||
|
self.assertNotEqual(second.pk, first.pk)
|
||||||
|
self.assertEqual(Notification.objects.count(), 2)
|
||||||
|
|
||||||
|
def test_same_idempotency_key_returns_the_original_row(self):
|
||||||
|
first = create_notification(
|
||||||
|
type=self.kind,
|
||||||
|
idempotency_key="approved:9",
|
||||||
|
recipients=[{"user": self.user, "channels": [{"channel": DeliveryChannel.BROWSER}]}],
|
||||||
|
)
|
||||||
|
second = create_notification(
|
||||||
|
type=self.kind,
|
||||||
|
verb="Other",
|
||||||
|
idempotency_key="approved:9",
|
||||||
|
group=True,
|
||||||
|
object_id="post-9",
|
||||||
|
recipients=self._recipients(),
|
||||||
|
)
|
||||||
|
self.assertEqual(second.pk, first.pk)
|
||||||
|
self.assertEqual(second.verb, first.verb)
|
||||||
|
self.assertEqual(Notification.objects.count(), 1)
|
||||||
|
self.assertEqual(second.recipients.count(), 1)
|
||||||
|
self.assertEqual(second.data, {})
|
||||||
|
|
||||||
|
def test_idempotency_conflict_returns_the_existing_row(self):
|
||||||
|
existing = Notification.objects.create(verb="Hi", idempotency_key="race")
|
||||||
|
with patch(
|
||||||
|
"notify.services._existing_idempotent",
|
||||||
|
side_effect=[None, existing],
|
||||||
|
):
|
||||||
|
returned = create_notification(
|
||||||
|
verb="Hi",
|
||||||
|
idempotency_key="race",
|
||||||
|
recipients=[{"user": self.user, "channels": [{"channel": DeliveryChannel.BROWSER}]}],
|
||||||
|
)
|
||||||
|
self.assertEqual(returned.pk, existing.pk)
|
||||||
|
self.assertEqual(Notification.objects.count(), 1)
|
||||||
|
self.assertEqual(existing.recipients.count(), 0)
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
from django.contrib import admin
|
||||||
|
from django.urls import include, path
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path("admin/", admin.site.urls),
|
||||||
|
path("api/", include("notify.urls")),
|
||||||
|
]
|
||||||
|
|
@ -0,0 +1,843 @@
|
||||||
|
version = 1
|
||||||
|
revision = 3
|
||||||
|
requires-python = ">=3.10"
|
||||||
|
resolution-markers = [
|
||||||
|
"python_full_version >= '3.11'",
|
||||||
|
"python_full_version < '3.11'",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "amqp"
|
||||||
|
version = "5.3.1"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "vine" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/79/fc/ec94a357dfc6683d8c86f8b4cfa5416a4c36b28052ec8260c77aca96a443/amqp-5.3.1.tar.gz", hash = "sha256:cddc00c725449522023bad949f70fff7b48f0b1ade74d170a6f10ab044739432", size = 129013, upload-time = "2024-11-12T19:55:44.051Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/26/99/fc813cd978842c26c82534010ea849eee9ab3a13ea2b74e95cb9c99e747b/amqp-5.3.1-py3-none-any.whl", hash = "sha256:43b3319e1b4e7d1251833a93d672b4af1e40f3d632d479b98661a95f117880a2", size = 50944, upload-time = "2024-11-12T19:55:41.782Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "annotated-types"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/ee/67/531ea369ba64dcff5ec9c3402f9f51bf748cec26dde048a2f973a4eea7f5/annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89", size = 16081, upload-time = "2024-05-20T21:33:25.928Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53", size = 13643, upload-time = "2024-05-20T21:33:24.1Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "asgiref"
|
||||||
|
version = "3.11.1"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "typing-extensions", marker = "python_full_version < '3.11'" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/63/40/f03da1264ae8f7cfdbf9146542e5e7e8100a4c66ab48e791df9a03d3f6c0/asgiref-3.11.1.tar.gz", hash = "sha256:5f184dc43b7e763efe848065441eac62229c9f7b0475f41f80e207a114eda4ce", size = 38550, upload-time = "2026-02-03T13:30:14.33Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/5c/0a/a72d10ed65068e115044937873362e6e32fab1b7dce0046aeb224682c989/asgiref-3.11.1-py3-none-any.whl", hash = "sha256:e8667a091e69529631969fd45dc268fa79b99c92c5fcdda727757e52146ec133", size = 24345, upload-time = "2026-02-03T13:30:13.039Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-timeout"
|
||||||
|
version = "5.0.1"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/a5/ae/136395dfbfe00dfc94da3f3e136d0b13f394cba8f4841120e34226265780/async_timeout-5.0.1.tar.gz", hash = "sha256:d9321a7a3d5a6a5e187e824d2fa0793ce379a202935782d555d6e9d2735677d3", size = 9274, upload-time = "2024-11-06T16:41:39.6Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/fe/ba/e2081de779ca30d473f21f5b30e0e737c438205440784c7dfc81efc2b029/async_timeout-5.0.1-py3-none-any.whl", hash = "sha256:39e3809566ff85354557ec2398b55e096c8364bacac9405a7a1fa429e77fe76c", size = 6233, upload-time = "2024-11-06T16:41:37.9Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "billiard"
|
||||||
|
version = "4.2.4"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/58/23/b12ac0bcdfb7360d664f40a00b1bda139cbbbced012c34e375506dbd0143/billiard-4.2.4.tar.gz", hash = "sha256:55f542c371209e03cd5862299b74e52e4fbcba8250ba611ad94276b369b6a85f", size = 156537, upload-time = "2025-11-30T13:28:48.52Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/cb/87/8bab77b323f16d67be364031220069f79159117dd5e43eeb4be2fef1ac9b/billiard-4.2.4-py3-none-any.whl", hash = "sha256:525b42bdec68d2b983347ac312f892db930858495db601b5836ac24e6477cde5", size = 87070, upload-time = "2025-11-30T13:28:47.016Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "celery"
|
||||||
|
version = "5.6.3"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "billiard" },
|
||||||
|
{ name = "click" },
|
||||||
|
{ name = "click-didyoumean" },
|
||||||
|
{ name = "click-plugins" },
|
||||||
|
{ name = "click-repl" },
|
||||||
|
{ name = "exceptiongroup", marker = "python_full_version < '3.11'" },
|
||||||
|
{ name = "kombu" },
|
||||||
|
{ name = "python-dateutil" },
|
||||||
|
{ name = "tzlocal" },
|
||||||
|
{ name = "vine" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/e8/b4/a1233943ab5c8ea05fb877a88a0a0622bf47444b99e4991a8045ac37ea1d/celery-5.6.3.tar.gz", hash = "sha256:177006bd2054b882e9f01be59abd8529e88879ef50d7918a7050c5a9f4e12912", size = 1742243, upload-time = "2026-03-26T12:14:51.76Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/cf/c9/6eccdda96e098f7ae843162db2d3c149c6931a24fda69fe4ab84d0027eb5/celery-5.6.3-py3-none-any.whl", hash = "sha256:0808f42f80909c4d5833202360ffafb2a4f83f4d8e23e1285d926610e9a7afa6", size = 451235, upload-time = "2026-03-26T12:14:49.491Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "certifi"
|
||||||
|
version = "2026.5.20"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/f3/ce/ee2ecad540810a79593028e88299baeae54d346cc7a0d94b6199988b89b1/certifi-2026.5.20.tar.gz", hash = "sha256:69dea482ab64caa7b9f6aba1c6bf48bb6a5448d1c0f1b17ab42ad8c763a5344d", size = 135422, upload-time = "2026-05-20T11:46:50.073Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/59/8c/57e832b7af6d7c5abe66eb3fbe3a3a32f4d11ea23a1aa7131371035be991/certifi-2026.5.20-py3-none-any.whl", hash = "sha256:3c52e209ba0a4ad7aebe60436a4ab349c39e1e602e8c134221e546902ad25897", size = 134134, upload-time = "2026-05-20T11:46:48.578Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "charset-normalizer"
|
||||||
|
version = "3.4.7"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/e7/a1/67fe25fac3c7642725500a3f6cfe5821ad557c3abb11c9d20d12c7008d3e/charset_normalizer-3.4.7.tar.gz", hash = "sha256:ae89db9e5f98a11a4bf50407d4363e7b09b31e55bc117b4f7d80aab97ba009e5", size = 144271, upload-time = "2026-04-02T09:28:39.342Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/26/08/0f303cb0b529e456bb116f2d50565a482694fbb94340bf56d44677e7ed03/charset_normalizer-3.4.7-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:cdd68a1fb318e290a2077696b7eb7a21a49163c455979c639bf5a5dcdc46617d", size = 315182, upload-time = "2026-04-02T09:25:40.673Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/24/47/b192933e94b546f1b1fe4df9cc1f84fcdbf2359f8d1081d46dd029b50207/charset_normalizer-3.4.7-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e17b8d5d6a8c47c85e68ca8379def1303fd360c3e22093a807cd34a71cd082b8", size = 209329, upload-time = "2026-04-02T09:25:42.354Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c2/b4/01fa81c5ca6141024d89a8fc15968002b71da7f825dd14113207113fabbd/charset_normalizer-3.4.7-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:511ef87c8aec0783e08ac18565a16d435372bc1ac25a91e6ac7f5ef2b0bff790", size = 231230, upload-time = "2026-04-02T09:25:44.281Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/20/f7/7b991776844dfa058017e600e6e55ff01984a063290ca5622c0b63162f68/charset_normalizer-3.4.7-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:007d05ec7321d12a40227aae9e2bc6dca73f3cb21058999a1df9e193555a9dcc", size = 225890, upload-time = "2026-04-02T09:25:45.475Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/20/e7/bed0024a0f4ab0c8a9c64d4445f39b30c99bd1acd228291959e3de664247/charset_normalizer-3.4.7-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:cf29836da5119f3c8a8a70667b0ef5fdca3bb12f80fd06487cfa575b3909b393", size = 216930, upload-time = "2026-04-02T09:25:46.58Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/e2/ab/b18f0ab31cdd7b3ddb8bb76c4a414aeb8160c9810fdf1bc62f269a539d87/charset_normalizer-3.4.7-cp310-cp310-manylinux_2_31_armv7l.whl", hash = "sha256:12d8baf840cc7889b37c7c770f478adea7adce3dcb3944d02ec87508e2dcf153", size = 202109, upload-time = "2026-04-02T09:25:48.031Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/82/e5/7e9440768a06dfb3075936490cb82dbf0ee20a133bf0dd8551fa096914ec/charset_normalizer-3.4.7-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:d560742f3c0d62afaccf9f41fe485ed69bd7661a241f86a3ef0f0fb8b1a397af", size = 214684, upload-time = "2026-04-02T09:25:49.245Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/71/94/8c61d8da9f062fdf457c80acfa25060ec22bf1d34bbeaca4350f13bcfd07/charset_normalizer-3.4.7-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:b14b2d9dac08e28bb8046a1a0434b1750eb221c8f5b87a68f4fa11a6f97b5e34", size = 212785, upload-time = "2026-04-02T09:25:50.671Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/66/cd/6e9889c648e72c0ab2e5967528bb83508f354d706637bc7097190c874e13/charset_normalizer-3.4.7-cp310-cp310-musllinux_1_2_armv7l.whl", hash = "sha256:bc17a677b21b3502a21f66a8cc64f5bfad4df8a0b8434d661666f8ce90ac3af1", size = 203055, upload-time = "2026-04-02T09:25:51.802Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/92/2e/7a951d6a08aefb7eb8e1b54cdfb580b1365afdd9dd484dc4bee9e5d8f258/charset_normalizer-3.4.7-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:750e02e074872a3fad7f233b47734166440af3cdea0add3e95163110816d6752", size = 232502, upload-time = "2026-04-02T09:25:53.388Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/58/d5/abcf2d83bf8e0a1286df55cd0dc1d49af0da4282aa77e986df343e7de124/charset_normalizer-3.4.7-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:4e5163c14bffd570ef2affbfdd77bba66383890797df43dc8b4cc7d6f500bf53", size = 214295, upload-time = "2026-04-02T09:25:54.765Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/47/3a/7d4cd7ed54be99973a0dc176032cba5cb1f258082c31fa6df35cff46acfc/charset_normalizer-3.4.7-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:6ed74185b2db44f41ef35fd1617c5888e59792da9bbc9190d6c7300617182616", size = 227145, upload-time = "2026-04-02T09:25:55.904Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/1d/98/3a45bf8247889cf28262ebd3d0872edff11565b2a1e3064ccb132db3fbb0/charset_normalizer-3.4.7-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:94e1885b270625a9a828c9793b4d52a64445299baa1fea5a173bf1d3dd9a1a5a", size = 218884, upload-time = "2026-04-02T09:25:57.074Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ad/80/2e8b7f8915ed5c9ef13aa828d82738e33888c485b65ebf744d615040c7ea/charset_normalizer-3.4.7-cp310-cp310-win32.whl", hash = "sha256:6785f414ae0f3c733c437e0f3929197934f526d19dfaa75e18fdb4f94c6fb374", size = 148343, upload-time = "2026-04-02T09:25:58.199Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/35/1b/3b8c8c77184af465ee9ad88b5aea46ea6b2e1f7b9dc9502891e37af21e30/charset_normalizer-3.4.7-cp310-cp310-win_amd64.whl", hash = "sha256:6696b7688f54f5af4462118f0bfa7c1621eeb87154f77fa04b9295ce7a8f2943", size = 159174, upload-time = "2026-04-02T09:25:59.322Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/be/c1/feb40dca40dbb21e0a908801782d9288c64fc8d8e562c2098e9994c8c21b/charset_normalizer-3.4.7-cp310-cp310-win_arm64.whl", hash = "sha256:66671f93accb62ed07da56613636f3641f1a12c13046ce91ffc923721f23c008", size = 147805, upload-time = "2026-04-02T09:26:00.756Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c2/d7/b5b7020a0565c2e9fa8c09f4b5fa6232feb326b8c20081ccded47ea368fd/charset_normalizer-3.4.7-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:7641bb8895e77f921102f72833904dcd9901df5d6d72a2ab8f31d04b7e51e4e7", size = 309705, upload-time = "2026-04-02T09:26:02.191Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/5a/53/58c29116c340e5456724ecd2fff4196d236b98f3da97b404bc5e51ac3493/charset_normalizer-3.4.7-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:202389074300232baeb53ae2569a60901f7efadd4245cf3a3bf0617d60b439d7", size = 206419, upload-time = "2026-04-02T09:26:03.583Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/b2/02/e8146dc6591a37a00e5144c63f29fb7c97a734ea8a111190783c0e60ab63/charset_normalizer-3.4.7-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:30b8d1d8c52a48c2c5690e152c169b673487a2a58de1ec7393196753063fcd5e", size = 227901, upload-time = "2026-04-02T09:26:04.738Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/fb/73/77486c4cd58f1267bf17db420e930c9afa1b3be3fe8c8b8ebbebc9624359/charset_normalizer-3.4.7-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:532bc9bf33a68613fd7d65e4b1c71a6a38d7d42604ecf239c77392e9b4e8998c", size = 222742, upload-time = "2026-04-02T09:26:06.36Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/a1/fa/f74eb381a7d94ded44739e9d94de18dc5edc9c17fb8c11f0a6890696c0a9/charset_normalizer-3.4.7-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2fe249cb4651fd12605b7288b24751d8bfd46d35f12a20b1ba33dea122e690df", size = 214061, upload-time = "2026-04-02T09:26:08.347Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/dc/92/42bd3cefcf7687253fb86694b45f37b733c97f59af3724f356fa92b8c344/charset_normalizer-3.4.7-cp311-cp311-manylinux_2_31_armv7l.whl", hash = "sha256:65bcd23054beab4d166035cabbc868a09c1a49d1efe458fe8e4361215df40265", size = 199239, upload-time = "2026-04-02T09:26:09.823Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/4c/3d/069e7184e2aa3b3cddc700e3dd267413dc259854adc3380421c805c6a17d/charset_normalizer-3.4.7-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:08e721811161356f97b4059a9ba7bafb23ea5ee2255402c42881c214e173c6b4", size = 210173, upload-time = "2026-04-02T09:26:10.953Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/62/51/9d56feb5f2e7074c46f93e0ebdbe61f0848ee246e2f0d89f8e20b89ebb8f/charset_normalizer-3.4.7-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:e060d01aec0a910bdccb8be71faf34e7799ce36950f8294c8bf612cba65a2c9e", size = 209841, upload-time = "2026-04-02T09:26:12.142Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d2/59/893d8f99cc4c837dda1fe2f1139079703deb9f321aabcb032355de13b6c7/charset_normalizer-3.4.7-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:38c0109396c4cfc574d502df99742a45c72c08eff0a36158b6f04000043dbf38", size = 200304, upload-time = "2026-04-02T09:26:13.711Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/7d/1d/ee6f3be3464247578d1ed5c46de545ccc3d3ff933695395c402c21fa6b77/charset_normalizer-3.4.7-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:1c2a768fdd44ee4a9339a9b0b130049139b8ce3c01d2ce09f67f5a68048d477c", size = 229455, upload-time = "2026-04-02T09:26:14.941Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/54/bb/8fb0a946296ea96a488928bdce8ef99023998c48e4713af533e9bb98ef07/charset_normalizer-3.4.7-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:1a87ca9d5df6fe460483d9a5bbf2b18f620cbed41b432e2bddb686228282d10b", size = 210036, upload-time = "2026-04-02T09:26:16.478Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/9a/bc/015b2387f913749f82afd4fcba07846d05b6d784dd16123cb66860e0237d/charset_normalizer-3.4.7-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:d635aab80466bc95771bb78d5370e74d36d1fe31467b6b29b8b57b2a3cd7d22c", size = 224739, upload-time = "2026-04-02T09:26:17.751Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/17/ab/63133691f56baae417493cba6b7c641571a2130eb7bceba6773367ab9ec5/charset_normalizer-3.4.7-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:ae196f021b5e7c78e918242d217db021ed2a6ace2bc6ae94c0fc596221c7f58d", size = 216277, upload-time = "2026-04-02T09:26:18.981Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/06/6d/3be70e827977f20db77c12a97e6a9f973631a45b8d186c084527e53e77a4/charset_normalizer-3.4.7-cp311-cp311-win32.whl", hash = "sha256:adb2597b428735679446b46c8badf467b4ca5f5056aae4d51a19f9570301b1ad", size = 147819, upload-time = "2026-04-02T09:26:20.295Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/20/d9/5f67790f06b735d7c7637171bbfd89882ad67201891b7275e51116ed8207/charset_normalizer-3.4.7-cp311-cp311-win_amd64.whl", hash = "sha256:8e385e4267ab76874ae30db04c627faaaf0b509e1ccc11a95b3fc3e83f855c00", size = 159281, upload-time = "2026-04-02T09:26:21.74Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ca/83/6413f36c5a34afead88ce6f66684d943d91f233d76dd083798f9602b75ae/charset_normalizer-3.4.7-cp311-cp311-win_arm64.whl", hash = "sha256:d4a48e5b3c2a489fae013b7589308a40146ee081f6f509e047e0e096084ceca1", size = 147843, upload-time = "2026-04-02T09:26:22.901Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/0c/eb/4fc8d0a7110eb5fc9cc161723a34a8a6c200ce3b4fbf681bc86feee22308/charset_normalizer-3.4.7-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:eca9705049ad3c7345d574e3510665cb2cf844c2f2dcfe675332677f081cbd46", size = 311328, upload-time = "2026-04-02T09:26:24.331Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/f8/e3/0fadc706008ac9d7b9b5be6dc767c05f9d3e5df51744ce4cc9605de7b9f4/charset_normalizer-3.4.7-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6178f72c5508bfc5fd446a5905e698c6212932f25bcdd4b47a757a50605a90e2", size = 208061, upload-time = "2026-04-02T09:26:25.568Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/42/f0/3dd1045c47f4a4604df85ec18ad093912ae1344ac706993aff91d38773a2/charset_normalizer-3.4.7-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:e1421b502d83040e6d7fb2fb18dff63957f720da3d77b2fbd3187ceb63755d7b", size = 229031, upload-time = "2026-04-02T09:26:26.865Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/dc/67/675a46eb016118a2fbde5a277a5d15f4f69d5f3f5f338e5ee2f8948fcf43/charset_normalizer-3.4.7-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:edac0f1ab77644605be2cbba52e6b7f630731fc42b34cb0f634be1a6eface56a", size = 225239, upload-time = "2026-04-02T09:26:28.044Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/4b/f8/d0118a2f5f23b02cd166fa385c60f9b0d4f9194f574e2b31cef350ad7223/charset_normalizer-3.4.7-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5649fd1c7bade02f320a462fdefd0b4bd3ce036065836d4f42e0de958038e116", size = 216589, upload-time = "2026-04-02T09:26:29.239Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/b1/f1/6d2b0b261b6c4ceef0fcb0d17a01cc5bc53586c2d4796fa04b5c540bc13d/charset_normalizer-3.4.7-cp312-cp312-manylinux_2_31_armv7l.whl", hash = "sha256:203104ed3e428044fd943bc4bf45fa73c0730391f9621e37fe39ecf477b128cb", size = 202733, upload-time = "2026-04-02T09:26:30.5Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/6f/c0/7b1f943f7e87cc3db9626ba17807d042c38645f0a1d4415c7a14afb5591f/charset_normalizer-3.4.7-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:298930cec56029e05497a76988377cbd7457ba864beeea92ad7e844fe74cd1f1", size = 212652, upload-time = "2026-04-02T09:26:31.709Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/38/dd/5a9ab159fe45c6e72079398f277b7d2b523e7f716acc489726115a910097/charset_normalizer-3.4.7-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:708838739abf24b2ceb208d0e22403dd018faeef86ddac04319a62ae884c4f15", size = 211229, upload-time = "2026-04-02T09:26:33.282Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d5/ff/531a1cad5ca855d1c1a8b69cb71abfd6d85c0291580146fda7c82857caa1/charset_normalizer-3.4.7-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:0f7eb884681e3938906ed0434f20c63046eacd0111c4ba96f27b76084cd679f5", size = 203552, upload-time = "2026-04-02T09:26:34.845Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c1/4c/a5fb52d528a8ca41f7598cb619409ece30a169fbdf9cdce592e53b46c3a6/charset_normalizer-3.4.7-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:4dc1e73c36828f982bfe79fadf5919923f8a6f4df2860804db9a98c48824ce8d", size = 230806, upload-time = "2026-04-02T09:26:36.152Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/59/7a/071feed8124111a32b316b33ae4de83d36923039ef8cf48120266844285b/charset_normalizer-3.4.7-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:aed52fea0513bac0ccde438c188c8a471c4e0f457c2dd20cdbf6ea7a450046c7", size = 212316, upload-time = "2026-04-02T09:26:37.672Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/fd/35/f7dba3994312d7ba508e041eaac39a36b120f32d4c8662b8814dab876431/charset_normalizer-3.4.7-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:fea24543955a6a729c45a73fe90e08c743f0b3334bbf3201e6c4bc1b0c7fa464", size = 227274, upload-time = "2026-04-02T09:26:38.93Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/8a/2d/a572df5c9204ab7688ec1edc895a73ebded3b023bb07364710b05dd1c9be/charset_normalizer-3.4.7-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:bb6d88045545b26da47aa879dd4a89a71d1dce0f0e549b1abcb31dfe4a8eac49", size = 218468, upload-time = "2026-04-02T09:26:40.17Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/86/eb/890922a8b03a568ca2f336c36585a4713c55d4d67bf0f0c78924be6315ca/charset_normalizer-3.4.7-cp312-cp312-win32.whl", hash = "sha256:2257141f39fe65a3fdf38aeccae4b953e5f3b3324f4ff0daf9f15b8518666a2c", size = 148460, upload-time = "2026-04-02T09:26:41.416Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/35/d9/0e7dffa06c5ab081f75b1b786f0aefc88365825dfcd0ac544bdb7b2b6853/charset_normalizer-3.4.7-cp312-cp312-win_amd64.whl", hash = "sha256:5ed6ab538499c8644b8a3e18debabcd7ce684f3fa91cf867521a7a0279cab2d6", size = 159330, upload-time = "2026-04-02T09:26:42.554Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/9e/5d/481bcc2a7c88ea6b0878c299547843b2521ccbc40980cb406267088bc701/charset_normalizer-3.4.7-cp312-cp312-win_arm64.whl", hash = "sha256:56be790f86bfb2c98fb742ce566dfb4816e5a83384616ab59c49e0604d49c51d", size = 147828, upload-time = "2026-04-02T09:26:44.075Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c1/3b/66777e39d3ae1ddc77ee606be4ec6d8cbd4c801f65e5a1b6f2b11b8346dd/charset_normalizer-3.4.7-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:f496c9c3cc02230093d8330875c4c3cdfc3b73612a5fd921c65d39cbcef08063", size = 309627, upload-time = "2026-04-02T09:26:45.198Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/2e/4e/b7f84e617b4854ade48a1b7915c8ccfadeba444d2a18c291f696e37f0d3b/charset_normalizer-3.4.7-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0ea948db76d31190bf08bd371623927ee1339d5f2a0b4b1b4a4439a65298703c", size = 207008, upload-time = "2026-04-02T09:26:46.824Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c4/bb/ec73c0257c9e11b268f018f068f5d00aa0ef8c8b09f7753ebd5f2880e248/charset_normalizer-3.4.7-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:a277ab8928b9f299723bc1a2dabb1265911b1a76341f90a510368ca44ad9ab66", size = 228303, upload-time = "2026-04-02T09:26:48.397Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/85/fb/32d1f5033484494619f701e719429c69b766bfc4dbc61aa9e9c8c166528b/charset_normalizer-3.4.7-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:3bec022aec2c514d9cf199522a802bd007cd588ab17ab2525f20f9c34d067c18", size = 224282, upload-time = "2026-04-02T09:26:49.684Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/fa/07/330e3a0dda4c404d6da83b327270906e9654a24f6c546dc886a0eb0ffb23/charset_normalizer-3.4.7-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e044c39e41b92c845bc815e5ae4230804e8e7bc29e399b0437d64222d92809dd", size = 215595, upload-time = "2026-04-02T09:26:50.915Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/e3/7c/fc890655786e423f02556e0216d4b8c6bcb6bdfa890160dc66bf52dee468/charset_normalizer-3.4.7-cp313-cp313-manylinux_2_31_armv7l.whl", hash = "sha256:f495a1652cf3fbab2eb0639776dad966c2fb874d79d87ca07f9d5f059b8bd215", size = 201986, upload-time = "2026-04-02T09:26:52.197Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d8/97/bfb18b3db2aed3b90cf54dc292ad79fdd5ad65c4eae454099475cbeadd0d/charset_normalizer-3.4.7-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:e712b419df8ba5e42b226c510472b37bd57b38e897d3eca5e8cfd410a29fa859", size = 211711, upload-time = "2026-04-02T09:26:53.49Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/6f/a5/a581c13798546a7fd557c82614a5c65a13df2157e9ad6373166d2a3e645d/charset_normalizer-3.4.7-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:7804338df6fcc08105c7745f1502ba68d900f45fd770d5bdd5288ddccb8a42d8", size = 210036, upload-time = "2026-04-02T09:26:54.975Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/8c/bf/b3ab5bcb478e4193d517644b0fb2bf5497fbceeaa7a1bc0f4d5b50953861/charset_normalizer-3.4.7-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:481551899c856c704d58119b5025793fa6730adda3571971af568f66d2424bb5", size = 202998, upload-time = "2026-04-02T09:26:56.303Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/e7/4e/23efd79b65d314fa320ec6017b4b5834d5c12a58ba4610aa353af2e2f577/charset_normalizer-3.4.7-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:f59099f9b66f0d7145115e6f80dd8b1d847176df89b234a5a6b3f00437aa0832", size = 230056, upload-time = "2026-04-02T09:26:57.554Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/b9/9f/1e1941bc3f0e01df116e68dc37a55c4d249df5e6fa77f008841aef68264f/charset_normalizer-3.4.7-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:f59ad4c0e8f6bba240a9bb85504faa1ab438237199d4cce5f622761507b8f6a6", size = 211537, upload-time = "2026-04-02T09:26:58.843Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/80/0f/088cbb3020d44428964a6c97fe1edfb1b9550396bf6d278330281e8b709c/charset_normalizer-3.4.7-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:3dedcc22d73ec993f42055eff4fcfed9318d1eeb9a6606c55892a26964964e48", size = 226176, upload-time = "2026-04-02T09:27:00.437Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/6a/9f/130394f9bbe06f4f63e22641d32fc9b202b7e251c9aef4db044324dac493/charset_normalizer-3.4.7-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:64f02c6841d7d83f832cd97ccf8eb8a906d06eb95d5276069175c696b024b60a", size = 217723, upload-time = "2026-04-02T09:27:02.021Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/73/55/c469897448a06e49f8fa03f6caae97074fde823f432a98f979cc42b90e69/charset_normalizer-3.4.7-cp313-cp313-win32.whl", hash = "sha256:4042d5c8f957e15221d423ba781e85d553722fc4113f523f2feb7b188cc34c5e", size = 148085, upload-time = "2026-04-02T09:27:03.192Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/5d/78/1b74c5bbb3f99b77a1715c91b3e0b5bdb6fe302d95ace4f5b1bec37b0167/charset_normalizer-3.4.7-cp313-cp313-win_amd64.whl", hash = "sha256:3946fa46a0cf3e4c8cb1cc52f56bb536310d34f25f01ca9b6c16afa767dab110", size = 158819, upload-time = "2026-04-02T09:27:04.454Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/68/86/46bd42279d323deb8687c4a5a811fd548cb7d1de10cf6535d099877a9a9f/charset_normalizer-3.4.7-cp313-cp313-win_arm64.whl", hash = "sha256:80d04837f55fc81da168b98de4f4b797ef007fc8a79ab71c6ec9bc4dd662b15b", size = 147915, upload-time = "2026-04-02T09:27:05.971Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/97/c8/c67cb8c70e19ef1960b97b22ed2a1567711de46c4ddf19799923adc836c2/charset_normalizer-3.4.7-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:c36c333c39be2dbca264d7803333c896ab8fa7d4d6f0ab7edb7dfd7aea6e98c0", size = 309234, upload-time = "2026-04-02T09:27:07.194Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/99/85/c091fdee33f20de70d6c8b522743b6f831a2f1cd3ff86de4c6a827c48a76/charset_normalizer-3.4.7-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1c2aed2e5e41f24ea8ef1590b8e848a79b56f3a5564a65ceec43c9d692dc7d8a", size = 208042, upload-time = "2026-04-02T09:27:08.749Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/87/1c/ab2ce611b984d2fd5d86a5a8a19c1ae26acac6bad967da4967562c75114d/charset_normalizer-3.4.7-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:54523e136b8948060c0fa0bc7b1b50c32c186f2fceee897a495406bb6e311d2b", size = 228706, upload-time = "2026-04-02T09:27:09.951Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/a8/29/2b1d2cb00bf085f59d29eb773ce58ec2d325430f8c216804a0a5cd83cbca/charset_normalizer-3.4.7-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:715479b9a2802ecac752a3b0efa2b0b60285cf962ee38414211abdfccc233b41", size = 224727, upload-time = "2026-04-02T09:27:11.175Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/47/5c/032c2d5a07fe4d4855fea851209cca2b6f03ebeb6d4e3afdb3358386a684/charset_normalizer-3.4.7-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bd6c2a1c7573c64738d716488d2cdd3c00e340e4835707d8fdb8dc1a66ef164e", size = 215882, upload-time = "2026-04-02T09:27:12.446Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/2c/c2/356065d5a8b78ed04499cae5f339f091946a6a74f91e03476c33f0ab7100/charset_normalizer-3.4.7-cp314-cp314-manylinux_2_31_armv7l.whl", hash = "sha256:c45e9440fb78f8ddabcf714b68f936737a121355bf59f3907f4e17721b9d1aae", size = 200860, upload-time = "2026-04-02T09:27:13.721Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/0c/cd/a32a84217ced5039f53b29f460962abb2d4420def55afabe45b1c3c7483d/charset_normalizer-3.4.7-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:3534e7dcbdcf757da6b85a0bbf5b6868786d5982dd959b065e65481644817a18", size = 211564, upload-time = "2026-04-02T09:27:15.272Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/44/86/58e6f13ce26cc3b8f4a36b94a0f22ae2f00a72534520f4ae6857c4b81f89/charset_normalizer-3.4.7-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:e8ac484bf18ce6975760921bb6148041faa8fef0547200386ea0b52b5d27bf7b", size = 211276, upload-time = "2026-04-02T09:27:16.834Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/8f/fe/d17c32dc72e17e155e06883efa84514ca375f8a528ba2546bee73fc4df81/charset_normalizer-3.4.7-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:a5fe03b42827c13cdccd08e6c0247b6a6d4b5e3cdc53fd1749f5896adcdc2356", size = 201238, upload-time = "2026-04-02T09:27:18.229Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/6a/29/f33daa50b06525a237451cdb6c69da366c381a3dadcd833fa5676bc468b3/charset_normalizer-3.4.7-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:2d6eb928e13016cea4f1f21d1e10c1cebd5a421bc57ddf5b1142ae3f86824fab", size = 230189, upload-time = "2026-04-02T09:27:19.445Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/b6/6e/52c84015394a6a0bdcd435210a7e944c5f94ea1055f5cc5d56c5fe368e7b/charset_normalizer-3.4.7-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:e74327fb75de8986940def6e8dee4f127cc9752bee7355bb323cc5b2659b6d46", size = 211352, upload-time = "2026-04-02T09:27:20.79Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/8c/d7/4353be581b373033fb9198bf1da3cf8f09c1082561e8e922aa7b39bf9fe8/charset_normalizer-3.4.7-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:d6038d37043bced98a66e68d3aa2b6a35505dc01328cd65217cefe82f25def44", size = 227024, upload-time = "2026-04-02T09:27:22.063Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/30/45/99d18aa925bd1740098ccd3060e238e21115fffbfdcb8f3ece837d0ace6c/charset_normalizer-3.4.7-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:7579e913a5339fb8fa133f6bbcfd8e6749696206cf05acdbdca71a1b436d8e72", size = 217869, upload-time = "2026-04-02T09:27:23.486Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/5c/05/5ee478aa53f4bb7996482153d4bfe1b89e0f087f0ab6b294fcf92d595873/charset_normalizer-3.4.7-cp314-cp314-win32.whl", hash = "sha256:5b77459df20e08151cd6f8b9ef8ef1f961ef73d85c21a555c7eed5b79410ec10", size = 148541, upload-time = "2026-04-02T09:27:25.146Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/48/77/72dcb0921b2ce86420b2d79d454c7022bf5be40202a2a07906b9f2a35c97/charset_normalizer-3.4.7-cp314-cp314-win_amd64.whl", hash = "sha256:92a0a01ead5e668468e952e4238cccd7c537364eb7d851ab144ab6627dbbe12f", size = 159634, upload-time = "2026-04-02T09:27:26.642Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c6/a3/c2369911cd72f02386e4e340770f6e158c7980267da16af8f668217abaa0/charset_normalizer-3.4.7-cp314-cp314-win_arm64.whl", hash = "sha256:67f6279d125ca0046a7fd386d01b311c6363844deac3e5b069b514ba3e63c246", size = 148384, upload-time = "2026-04-02T09:27:28.271Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/94/09/7e8a7f73d24dba1f0035fbbf014d2c36828fc1bf9c88f84093e57d315935/charset_normalizer-3.4.7-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:effc3f449787117233702311a1b7d8f59cba9ced946ba727bdc329ec69028e24", size = 330133, upload-time = "2026-04-02T09:27:29.474Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/8d/da/96975ddb11f8e977f706f45cddd8540fd8242f71ecdb5d18a80723dcf62c/charset_normalizer-3.4.7-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:fbccdc05410c9ee21bbf16a35f4c1d16123dcdeb8a1d38f33654fa21d0234f79", size = 216257, upload-time = "2026-04-02T09:27:30.793Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/e5/e8/1d63bf8ef2d388e95c64b2098f45f84758f6d102a087552da1485912637b/charset_normalizer-3.4.7-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:733784b6d6def852c814bce5f318d25da2ee65dd4839a0718641c696e09a2960", size = 234851, upload-time = "2026-04-02T09:27:32.44Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/9b/40/e5ff04233e70da2681fa43969ad6f66ca5611d7e669be0246c4c7aaf6dc8/charset_normalizer-3.4.7-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:a89c23ef8d2c6b27fd200a42aa4ac72786e7c60d40efdc76e6011260b6e949c4", size = 233393, upload-time = "2026-04-02T09:27:34.03Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/be/c1/06c6c49d5a5450f76899992f1ee40b41d076aee9279b49cf9974d2f313d5/charset_normalizer-3.4.7-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6c114670c45346afedc0d947faf3c7f701051d2518b943679c8ff88befe14f8e", size = 223251, upload-time = "2026-04-02T09:27:35.369Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/2b/9f/f2ff16fb050946169e3e1f82134d107e5d4ae72647ec8a1b1446c148480f/charset_normalizer-3.4.7-cp314-cp314t-manylinux_2_31_armv7l.whl", hash = "sha256:a180c5e59792af262bf263b21a3c49353f25945d8d9f70628e73de370d55e1e1", size = 206609, upload-time = "2026-04-02T09:27:36.661Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/69/d5/a527c0cd8d64d2eab7459784fb4169a0ac76e5a6fc5237337982fd61347e/charset_normalizer-3.4.7-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:3c9a494bc5ec77d43cea229c4f6db1e4d8fe7e1bbffa8b6f0f0032430ff8ab44", size = 220014, upload-time = "2026-04-02T09:27:38.019Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/7e/80/8a7b8104a3e203074dc9aa2c613d4b726c0e136bad1cc734594b02867972/charset_normalizer-3.4.7-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:8d828b6667a32a728a1ad1d93957cdf37489c57b97ae6c4de2860fa749b8fc1e", size = 218979, upload-time = "2026-04-02T09:27:39.37Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/02/9a/b759b503d507f375b2b5c153e4d2ee0a75aa215b7f2489cf314f4541f2c0/charset_normalizer-3.4.7-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:cf1493cd8607bec4d8a7b9b004e699fcf8f9103a9284cc94962cb73d20f9d4a3", size = 209238, upload-time = "2026-04-02T09:27:40.722Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c2/4e/0f3f5d47b86bdb79256e7290b26ac847a2832d9a4033f7eb2cd4bcf4bb5b/charset_normalizer-3.4.7-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:0c96c3b819b5c3e9e165495db84d41914d6894d55181d2d108cc1a69bfc9cce0", size = 236110, upload-time = "2026-04-02T09:27:42.33Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/96/23/bce28734eb3ed2c91dcf93abeb8a5cf393a7b2749725030bb630e554fdd8/charset_normalizer-3.4.7-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:752a45dc4a6934060b3b0dab47e04edc3326575f82be64bc4fc293914566503e", size = 219824, upload-time = "2026-04-02T09:27:43.924Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/2c/6f/6e897c6984cc4d41af319b077f2f600fc8214eb2fe2d6bcb79141b882400/charset_normalizer-3.4.7-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:8778f0c7a52e56f75d12dae53ae320fae900a8b9b4164b981b9c5ce059cd1fcb", size = 233103, upload-time = "2026-04-02T09:27:45.348Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/76/22/ef7bd0fe480a0ae9b656189ec00744b60933f68b4f42a7bb06589f6f576a/charset_normalizer-3.4.7-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:ce3412fbe1e31eb81ea42f4169ed94861c56e643189e1e75f0041f3fe7020abe", size = 225194, upload-time = "2026-04-02T09:27:46.706Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c5/a7/0e0ab3e0b5bc1219bd80a6a0d4d72ca74d9250cb2382b7c699c147e06017/charset_normalizer-3.4.7-cp314-cp314t-win32.whl", hash = "sha256:c03a41a8784091e67a39648f70c5f97b5b6a37f216896d44d2cdcb82615339a0", size = 159827, upload-time = "2026-04-02T09:27:48.053Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/7a/1d/29d32e0fb40864b1f878c7f5a0b343ae676c6e2b271a2d55cc3a152391da/charset_normalizer-3.4.7-cp314-cp314t-win_amd64.whl", hash = "sha256:03853ed82eeebbce3c2abfdbc98c96dc205f32a79627688ac9a27370ea61a49c", size = 174168, upload-time = "2026-04-02T09:27:49.795Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/de/32/d92444ad05c7a6e41fb2036749777c163baf7a0301a040cb672d6b2b1ae9/charset_normalizer-3.4.7-cp314-cp314t-win_arm64.whl", hash = "sha256:c35abb8bfff0185efac5878da64c45dafd2b37fb0383add1be155a763c1f083d", size = 153018, upload-time = "2026-04-02T09:27:51.116Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/db/8f/61959034484a4a7c527811f4721e75d02d653a35afb0b6054474d8185d4c/charset_normalizer-3.4.7-py3-none-any.whl", hash = "sha256:3dce51d0f5e7951f8bb4900c257dad282f49190fdbebecd4ba99bcc41fef404d", size = 61958, upload-time = "2026-04-02T09:28:37.794Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "click"
|
||||||
|
version = "8.4.1"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "colorama", marker = "sys_platform == 'win32'" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/9b/98/518d8e5081007684232226f475082b30087d0f585e8457db087298259f49/click-8.4.1.tar.gz", hash = "sha256:918b5633eddf6b41c32d4f454bf0de810065c74e3f7dbf8ee5452f8be88d3e96", size = 353007, upload-time = "2026-05-22T04:08:37.769Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c7/0d/67e5b4109ea4a837e80daa87c2c696711955e40449a97e8926672534def2/click-8.4.1-py3-none-any.whl", hash = "sha256:482be17c6991b8c19c5429a1e995d9b0efdbb63172824c41f99965dc0ade8ec2", size = 116639, upload-time = "2026-05-22T04:08:35.26Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "click-didyoumean"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "click" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/30/ce/217289b77c590ea1e7c24242d9ddd6e249e52c795ff10fac2c50062c48cb/click_didyoumean-0.3.1.tar.gz", hash = "sha256:4f82fdff0dbe64ef8ab2279bd6aa3f6a99c3b28c05aa09cbfc07c9d7fbb5a463", size = 3089, upload-time = "2024-03-24T08:22:07.499Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/1b/5b/974430b5ffdb7a4f1941d13d83c64a0395114503cc357c6b9ae4ce5047ed/click_didyoumean-0.3.1-py3-none-any.whl", hash = "sha256:5c4bb6007cfea5f2fd6583a2fb6701a22a41eb98957e63d0fac41c10e7c3117c", size = 3631, upload-time = "2024-03-24T08:22:06.356Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "click-plugins"
|
||||||
|
version = "1.1.1.2"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "click" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/c3/a4/34847b59150da33690a36da3681d6bbc2ec14ee9a846bc30a6746e5984e4/click_plugins-1.1.1.2.tar.gz", hash = "sha256:d7af3984a99d243c131aa1a828331e7630f4a88a9741fd05c927b204bcf92261", size = 8343, upload-time = "2025-06-25T00:47:37.555Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/3d/9a/2abecb28ae875e39c8cad711eb1186d8d14eab564705325e77e4e6ab9ae5/click_plugins-1.1.1.2-py2.py3-none-any.whl", hash = "sha256:008d65743833ffc1f5417bf0e78e8d2c23aab04d9745ba817bd3e71b0feb6aa6", size = 11051, upload-time = "2025-06-25T00:47:36.731Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "click-repl"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "click" },
|
||||||
|
{ name = "prompt-toolkit" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/cb/a2/57f4ac79838cfae6912f997b4d1a64a858fb0c86d7fcaae6f7b58d267fca/click-repl-0.3.0.tar.gz", hash = "sha256:17849c23dba3d667247dc4defe1757fff98694e90fe37474f3feebb69ced26a9", size = 10449, upload-time = "2023-06-15T12:43:51.141Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/52/40/9d857001228658f0d59e97ebd4c346fe73e138c6de1bce61dc568a57c7f8/click_repl-0.3.0-py3-none-any.whl", hash = "sha256:fb7e06deb8da8de86180a33a9da97ac316751c094c6899382da7feeeeb51b812", size = 10289, upload-time = "2023-06-15T12:43:48.626Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "colorama"
|
||||||
|
version = "0.4.6"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "django"
|
||||||
|
version = "5.0.6"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "asgiref" },
|
||||||
|
{ name = "sqlparse" },
|
||||||
|
{ name = "tzdata", marker = "sys_platform == 'win32'" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/4c/d3/b0dae3b5e6412227ec4387cf39110be3432c53886d2927c78b5f6976f1cb/Django-5.0.6.tar.gz", hash = "sha256:ff1b61005004e476e0aeea47c7f79b85864c70124030e95146315396f1e7951f", size = 10639679, upload-time = "2024-05-07T16:55:48.753Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/1d/23/02f3795a71196019bcfec4c67890a6369e43b023474154fa0b2b7060346d/Django-5.0.6-py3-none-any.whl", hash = "sha256:8363ac062bb4ef7c3f12d078f6fa5d154031d129a15170a1066412af49d30905", size = 8183735, upload-time = "2024-05-07T16:55:41.136Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "django-ace-editor"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/eb/62/13679473a858c3ecabfb83f9c584233d7cc8af3e0da94b7b87a8ea82f802/django_ace_editor-0.1.0.tar.gz", hash = "sha256:c0e03dd0960343e325bc970a52bf10a3142a2f3e0b7b59fb67a3cc70c7993b48", size = 312942, upload-time = "2026-06-01T10:05:23.005Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/29/48/2478046b22c39b3c570d4d8017b6c2e130e28615993cfc403f8ec7ad1a84/django_ace_editor-0.1.0-py3-none-any.whl", hash = "sha256:2ae052b9c051cc41c3aa5d86c6c1a45489b00cc49da30ad5ae055efd1cf6bf02", size = 325288, upload-time = "2026-06-01T10:05:21.11Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "django-ninja"
|
||||||
|
version = "1.6.2"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "django" },
|
||||||
|
{ name = "pydantic" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/d5/7c/3307e17b872f545c88314b2737a22f965785dfb5a120d739b0131d0492c3/django_ninja-1.6.2.tar.gz", hash = "sha256:d56ae5aa4791068ef4ac9a66cfdf2fc11f507413ded35abb79c51d0d52ad6412", size = 3685599, upload-time = "2026-03-18T20:06:47.284Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/21/0c/25f72060a39632fbd2d90e9c8b6052a09cd45b0598fc06c0758d313f0052/django_ninja-1.6.2-py3-none-any.whl", hash = "sha256:20095f5900bada22ea00cf1a58af50bdb285b2354c61a9d9b47d0dc89ac462d6", size = 2374994, upload-time = "2026-03-18T20:06:45.676Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dnspython"
|
||||||
|
version = "2.8.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
resolution-markers = [
|
||||||
|
"python_full_version < '3.11'",
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/8c/8b/57666417c0f90f08bcafa776861060426765fdb422eb10212086fb811d26/dnspython-2.8.0.tar.gz", hash = "sha256:181d3c6996452cb1189c4046c61599b84a5a86e099562ffde77d26984ff26d0f", size = 368251, upload-time = "2025-09-07T18:58:00.022Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ba/5a/18ad964b0086c6e62e2e7500f7edc89e3faa45033c71c1893d34eed2b2de/dnspython-2.8.0-py3-none-any.whl", hash = "sha256:01d9bbc4a2d76bf0db7c1f729812ded6d912bd318d3b1cf81d30c0f845dbf3af", size = 331094, upload-time = "2025-09-07T18:57:58.071Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dnspython"
|
||||||
|
version = "2.9.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
resolution-markers = [
|
||||||
|
"python_full_version >= '3.11'",
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/ef/4a/50822184bd67cc6493f0fb6a880749158fcd31ab3fa07409acfd91f9fc85/dnspython-2.9.0.tar.gz", hash = "sha256:b44dc6b18f07a8b1c56676a19fbfdb5209415b046a9cece286baafa87ff3f7f1", size = 423560, upload-time = "2026-10-09T00:07:24.352Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/10/02/cdcc9b7c051786a103c3b09e1003a82fa0c66bcb91ffbdabcfbf7b4163b9/dnspython-2.9.0-py3-none-any.whl", hash = "sha256:9a4aedb833c3c1b49214d04d44d3032ab7a9135f7c1d29a549b4ff78fd82fda9", size = 354822, upload-time = "2026-10-09T00:07:22.622Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "email-validator"
|
||||||
|
version = "2.3.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "dnspython", version = "2.8.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
|
||||||
|
{ name = "dnspython", version = "2.9.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
|
||||||
|
{ name = "idna" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/f5/22/900cb125c76b7aaa450ce02fd727f452243f2e91a61af068b40adba60ea9/email_validator-2.3.0.tar.gz", hash = "sha256:9fc05c37f2f6cf439ff414f8fc46d917929974a82244c20eb10231ba60c54426", size = 51238, upload-time = "2025-08-26T13:09:06.831Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/de/15/545e2b6cf2e3be84bc1ed85613edd75b8aea69807a71c26f4ca6a9258e82/email_validator-2.3.0-py3-none-any.whl", hash = "sha256:80f13f623413e6b197ae73bb10bf4eb0908faf509ad8362c5edeb0be7fd450b4", size = 35604, upload-time = "2025-08-26T13:09:05.858Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "exceptiongroup"
|
||||||
|
version = "1.3.1"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "typing-extensions" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/50/79/66800aadf48771f6b62f7eb014e352e5d06856655206165d775e675a02c9/exceptiongroup-1.3.1.tar.gz", hash = "sha256:8b412432c6055b0b7d14c310000ae93352ed6754f70fa8f7c34141f91c4e3219", size = 30371, upload-time = "2025-11-21T23:01:54.787Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/8a/0e/97c33bf5009bdbac74fd2beace167cab3f978feb69cc36f1ef79360d6c4e/exceptiongroup-1.3.1-py3-none-any.whl", hash = "sha256:a7a39a3bd276781e98394987d3a5701d0c4edffb633bb7a5144577f82c773598", size = 16740, upload-time = "2025-11-21T23:01:53.443Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "idna"
|
||||||
|
version = "3.17"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/b9/28/99c51f664567218d824af024c0251650fb27e4ca066df188dab0769c5b91/idna-3.17.tar.gz", hash = "sha256:5eb0cb53bc467c12eadcf6de83163ad8527cec9416f44b9b61b19caedad2b87f", size = 196048, upload-time = "2026-05-28T14:32:38.55Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/de/a7/f76514cc40ad6234098ecdebda08732d75964776c51a42845b7da10649e2/idna-3.17-py3-none-any.whl", hash = "sha256:466e48829084efe2548012b855df21540b96f2e20e51bd124c851536556a592c", size = 65316, upload-time = "2026-05-28T14:32:37.035Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "jinja2"
|
||||||
|
version = "3.1.6"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "markupsafe" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/df/bf/f7da0350254c0ed7c72f3e33cef02e048281fec7ecec5f032d4aac52226b/jinja2-3.1.6.tar.gz", hash = "sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d", size = 245115, upload-time = "2025-03-05T20:05:02.478Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/62/a1/3d680cbfd5f4b8f15abc1d571870c5fc3e594bb582bc3b64ea099db13e56/jinja2-3.1.6-py3-none-any.whl", hash = "sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67", size = 134899, upload-time = "2025-03-05T20:05:00.369Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "kombu"
|
||||||
|
version = "5.6.2"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "amqp" },
|
||||||
|
{ name = "packaging" },
|
||||||
|
{ name = "tzdata" },
|
||||||
|
{ name = "vine" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/b6/a5/607e533ed6c83ae1a696969b8e1c137dfebd5759a2e9682e26ff1b97740b/kombu-5.6.2.tar.gz", hash = "sha256:8060497058066c6f5aed7c26d7cd0d3b574990b09de842a8c5aaed0b92cc5a55", size = 472594, upload-time = "2025-12-29T20:30:07.779Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/fb/0f/834427d8c03ff1d7e867d3db3d176470c64871753252b21b4f4897d1fa45/kombu-5.6.2-py3-none-any.whl", hash = "sha256:efcfc559da324d41d61ca311b0c64965ea35b4c55cc04ee36e55386145dace93", size = 214219, upload-time = "2025-12-29T20:30:05.74Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "markdown"
|
||||||
|
version = "3.10"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/7d/ab/7dd27d9d863b3376fcf23a5a13cb5d024aed1db46f963f1b5735ae43b3be/markdown-3.10.tar.gz", hash = "sha256:37062d4f2aa4b2b6b32aefb80faa300f82cc790cb949a35b8caede34f2b68c0e", size = 364931, upload-time = "2025-11-03T19:51:15.007Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/70/81/54e3ce63502cd085a0c556652a4e1b919c45a446bd1e5300e10c44c8c521/markdown-3.10-py3-none-any.whl", hash = "sha256:b5b99d6951e2e4948d939255596523444c0e677c669700b1d17aa4a8a464cb7c", size = 107678, upload-time = "2025-11-03T19:51:13.887Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "markupsafe"
|
||||||
|
version = "3.0.4"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/38/9b/e422a865e1d5d57d0e509b4e0bf1c1a70a7f6382c29a5aa428df994c8bc8/markupsafe-3.0.4.tar.gz", hash = "sha256:2e9ad7dd851bf45fab9f75cbff4cb493fee9979e8d8c7c9c3ee119022518edd6", size = 153777, upload-time = "2026-10-02T23:07:22.29Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/41/aa/9a65962e364bf19745f6bec7bde398fb1f5ca53ad2e734258e6198cc32ba/markupsafe-3.0.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:dd8ea6ebee7aedbf7c749fa80521d9ccf1ba473e0d1e14805caafbaad281c889", size = 11521, upload-time = "2026-10-02T23:04:20.141Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/14/36/927999a34b7d1def6957de89153d327fedc4030061940b5a468584e6c5a8/markupsafe-3.0.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:dff05cb7016dff1e9fd68f4122c127b65dfc59de5306cfb7ad92f956f230bee2", size = 12066, upload-time = "2026-10-02T23:04:21.275Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/17/54/69e7b0db9bd687bfd83451eed5666384d67cfed3be062bfc59a06a15474e/markupsafe-3.0.4-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:cf63c214fe879a65e69a386f915e36104fc84254ab141240f8854602d8e0be2a", size = 22081, upload-time = "2026-10-02T23:04:22.221Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/bd/14/f6f5c97903f7d2db76bbfaced31509a47d360a103b3aaf4849f6536591ec/markupsafe-3.0.4-cp310-cp310-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:2a6ef68ae94aed8721934072b27a3b654ea2100b97e4ab864cf1489c90926fbc", size = 26079, upload-time = "2026-10-02T23:04:23.346Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d0/04/c3cc9b75f94f8b54d7e503c44cebd4b4a115ec1d6f1b996b999807daba99/markupsafe-3.0.4-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:fd9f8797427910198f95bced71ddfed61130d7e349213bfb8466c9c99e2c46a8", size = 22611, upload-time = "2026-10-02T23:04:24.401Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/00/26/c4708ed3b0f08e8e6d7cbce3314ac130cb5352d1f62951b6fef7878f2b1e/markupsafe-3.0.4-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d1aca03ede943eb80ab3d63bb082c84b7aab85ea83bd0fd0c200260945fb49d9", size = 20712, upload-time = "2026-10-02T23:04:25.386Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d9/b9/f3894d6aae3d7a52c9363317f4baf2fcadc052163d6dbc871266e32639ed/markupsafe-3.0.4-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:0764a13d34cae40db7bbf3a09b7e9b491bf4603e20b263a7a9d6b8e324975d0a", size = 20742, upload-time = "2026-10-02T23:04:26.403Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/59/7c/8e248ddbfe286ab6bddb462bdac0851cbb1510d2cbbb815a415fcb0511af/markupsafe-3.0.4-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:9388003072b95f2f1e3fd908604194d653ba21330d811961a78b7da1a77e9e36", size = 21560, upload-time = "2026-10-02T23:04:27.522Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/df/26/2353fef7d4bcf2b18e16bad81979fcecff2915156ca6882447917205b8e2/markupsafe-3.0.4-cp310-cp310-musllinux_1_2_armv7l.whl", hash = "sha256:8698d70a8081ee8c090dbb394768b5789a1da8b131b5499f89d071dd3cfaf6be", size = 20973, upload-time = "2026-10-02T23:04:28.573Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/67/6f/a9561d98d9a6ee3494b0b970a1c766e58bab128cc84841d56ec009456dbd/markupsafe-3.0.4-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:bf053da3c97a4bc5ecfbb218cdd2983febd91c617be8367d139882aa11e490aa", size = 22036, upload-time = "2026-10-02T23:04:29.568Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/55/83/6217df9192eca95af3ff0cad955c9854a93fa43b288cf7411ae24713eb52/markupsafe-3.0.4-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:9438a2648b2195980cb2dd8e53ed7b8df91319e2d0b70ae61a9e1d1bc8d3bec9", size = 20314, upload-time = "2026-10-02T23:04:30.881Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/35/7c/9cd8081dae70e17fdab3558121fa618d459c7950c8abd8fc10fc024486d7/markupsafe-3.0.4-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:88d59b473bfb03259722600839af9bbd7fa13a2eb514beefeedb95997882f69a", size = 20780, upload-time = "2026-10-02T23:04:31.975Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/44/37/c5f2f45f4d8f0c24e4af7b9dc711640c888044cbf5f7e2ba2c0bb74cbb55/markupsafe-3.0.4-cp310-cp310-win32.whl", hash = "sha256:4a540e2d3192792fc84eced57bef37851ccb2b41f73291bb17408eea77bcd278", size = 14096, upload-time = "2026-10-02T23:04:33.129Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/50/50/394a1c61c9b9972cb4f76875c332af7109bd39bdad09d3a0ec5327a339dc/markupsafe-3.0.4-cp310-cp310-win_amd64.whl", hash = "sha256:5c22873ad1f0532ba40fa1727f3c0fc1bbbaab6d373d4cbe3f0dc74b2e2521c7", size = 14329, upload-time = "2026-10-02T23:04:34.168Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d1/9a/86d03d2f32ba41a57baa124a7bcb76d0a6d39b1622e9bd4d550074e8b61a/markupsafe-3.0.4-cp310-cp310-win_arm64.whl", hash = "sha256:3d23795802fc8bd72534836d64489bbf0f67c088959091bdb22e10735a5107bf", size = 14196, upload-time = "2026-10-02T23:04:35.201Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/32/55/18dbb4778b30ada5ce071608503cc3edc9e14e13d868c17a6d178fc30f7a/markupsafe-3.0.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:9e25feb9e330b63edb0278a0acdf85e50d0cb0fbf49c3084abbe4e24ae195346", size = 11520, upload-time = "2026-10-02T23:04:36.299Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/6c/14/0b05f79b4733e264a18d08fe08fa1df7347630ff32a6cb82180d9dccec55/markupsafe-3.0.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:7d3391b2188d18737cb2fa147028b1096236eaa7e156446c650a489fa2cadc91", size = 12063, upload-time = "2026-10-02T23:04:37.291Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ca/3a/63ba10b6c1463216b3e4df669a9f0e5a3b0c3071557d2e8229e3968c79fb/markupsafe-3.0.4-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:849dd2bb0e5e4ab2b71c7191726a4a8d5aa8a610daa584728cbee0b710ddc4ef", size = 24321, upload-time = "2026-10-02T23:04:38.262Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/1a/2e/5f015261b76ad633d187ef6f388b413aedd64a8773c4df59e530a0be5525/markupsafe-3.0.4-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:befb4158af32106b9a93db8d6d1d1cbbd418c0d5aca0cabb7b1780abf0c89169", size = 28845, upload-time = "2026-10-02T23:04:39.295Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/33/cf/26e594b26be40c2f1fec63ccf8a8b99d0335a5b2cbe84835c7d82a994375/markupsafe-3.0.4-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:71f88e749ea29f67f21f3b36433c1dc54c7729ed2a6d9e2da2e0d9e0d7b224eb", size = 24701, upload-time = "2026-10-02T23:04:40.348Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/81/a5/a513b76c139a3915b43404324e55c0b7979ae4f0d39eb6f075b0282e90a8/markupsafe-3.0.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6da83a088f8ef93b2d483a8232a4dbf4d69d3d8496b568a03c56becac43e1808", size = 22961, upload-time = "2026-10-02T23:04:41.372Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/46/cf/4c66192c100b4542bcbe392ae06696b670f66927be3ac38a213234778ff9/markupsafe-3.0.4-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:8f0fac8b13d14bb06c68195f849371924ae53dd7b1c00fed24650f704383b692", size = 21920, upload-time = "2026-10-02T23:04:42.429Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/cb/17/ac3662678bfbad649893117ada2ba44dc30bf56884e84f13154a792b10f1/markupsafe-3.0.4-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:4a7cdc2a420ca01058182da4253329764d4bfa055564d1eced90e6ba1e8b1d3d", size = 23726, upload-time = "2026-10-02T23:04:43.531Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/f7/af/fe47cee339180a69ebca3c57fb3483d0f5cbd1e8337d1871fb1d9c1aebee/markupsafe-3.0.4-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:83b3944fea42a8400edf92fd1770fb8d0d4f7de651353bd2d8525a92dba69a21", size = 22539, upload-time = "2026-10-02T23:04:44.618Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/12/32/d55440ba140442800e02d799c9cb5ab597bf6ebdb1177b5ea39a11f797bd/markupsafe-3.0.4-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:8138eb83940ec7299024d92d4dee45f601b9e6c5ffde9d25f4e35e326203c707", size = 23963, upload-time = "2026-10-02T23:04:45.656Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/50/9d/9c86042cb364c2ad4c971e6d1247929effd25f714cd7ee11b05e6316445b/markupsafe-3.0.4-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:811d02d5122171c1941357efd8f9bf4ffe907b7f0a1a4e729a880e4be3f46e3e", size = 21506, upload-time = "2026-10-02T23:04:46.671Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/75/ef/5b824f03ba40c3b3652b6272d083d2fc4fcdd440de519a3a39ba2c3e7262/markupsafe-3.0.4-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:50b5bedc9ed8a94fc8857a42ef4f84a81ea88f8d4f05dc8705fb23ee6d8dcca7", size = 22955, upload-time = "2026-10-02T23:04:47.698Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/1e/e8/44cfcb5ea40e5e43cec7793ef90704ed0c475280839076c4345757eb8e59/markupsafe-3.0.4-cp311-cp311-win32.whl", hash = "sha256:2e5a7cd7fdd14fcb1ae5d7d8bf23d24fbd1daefd1fbca2580132e1ea75f098b5", size = 14094, upload-time = "2026-10-02T23:04:48.788Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/91/89/f2b509f7bf79352e40117824c1070dbeafd4df67031d3fa98165a3134228/markupsafe-3.0.4-cp311-cp311-win_amd64.whl", hash = "sha256:fdb4ca07ab75ffadab4a8b135ad59cdbb3156b99310f3d565370da74a15d6bd3", size = 14328, upload-time = "2026-10-02T23:04:49.801Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/2b/5a/ccf22672a0f64dc682306e288f0dabcb06c7a201f3bb6e6cbf86d9e8ad03/markupsafe-3.0.4-cp311-cp311-win_arm64.whl", hash = "sha256:569d65055d367e3dcdf30c3f41119467b73d9ee9faf332bdf40402644f5ac08e", size = 14188, upload-time = "2026-10-02T23:04:50.847Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/81/09/4c59d56b8461ae8eb0d8ba34bb25b7e618547044679d58a82ef9b2479fc1/markupsafe-3.0.4-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:61631e08084be9e21a8967ec3139c7616ed7c5e9368e05c86d1b39562c8a57b6", size = 11658, upload-time = "2026-10-02T23:04:51.876Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/a2/f0/d6613774d86fbf6d145751d43c59875e47a6f9f17daee0aef173bd36d90e/markupsafe-3.0.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:0930db9bdc62d22944e10b066448bb65dc9abe9112880c7cab8da54db4284d5f", size = 12050, upload-time = "2026-10-02T23:04:52.931Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/0d/f2/8f18e0b806eb13c1f8d07d917a720831ead54253a6dec011fbc78098a6f8/markupsafe-3.0.4-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6a45c3d514f2436064db00d7fc8778d888f0236ebfed649b53d13a59e69ad51b", size = 24363, upload-time = "2026-10-02T23:04:53.895Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/60/ce/fa07dbe8a5675558fa36dea033e19995bc783de2dec5f540ccb9030b06aa/markupsafe-3.0.4-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:1e1451fab512d1bcc3dc26988ec1edb0b82c2db909132872cd9356070a6b63df", size = 28525, upload-time = "2026-10-02T23:04:54.905Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/85/40/be87c01f3868ec217f8a2015089d71c22c8c5a75324822e5ed1cdd87210d/markupsafe-3.0.4-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:bd3ce56ae2cbae3ba82b683bc425cd7e48d2ed8b10f3e818186b6f5646d9271c", size = 24733, upload-time = "2026-10-02T23:04:56.229Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/4f/a7/aeedb5140afa41fc74c225e9184ab96723a6e873b6ee1c9fede7283456d8/markupsafe-3.0.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8e124f974786f831d6043728e38296969d3579db8896fe004682f5758e613581", size = 22985, upload-time = "2026-10-02T23:04:57.521Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c3/fc/e91352bb08c6a59da3ef0909d457bf95a5f5908fbf151b30a06d9dbcfbb4/markupsafe-3.0.4-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:c02e8f18bdedba082cef725942ac823b9b60656db07f7e265cb31618dfd00d77", size = 22001, upload-time = "2026-10-02T23:04:58.597Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/5d/f8/bffee5e7d2a3deb59748a797650a48af7e672025cf641a79344a771ad106/markupsafe-3.0.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:9f098115c247e11d138ab83a28fa0323c77015007ea2df73ba5fd714dfefd67c", size = 23793, upload-time = "2026-10-02T23:04:59.686Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ed/59/b853d6628ecb4d658e1d637224846d5e9bb4adf4f8df97f3be9f29dce2ec/markupsafe-3.0.4-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:d5f93ebbeb8032d47e349328ec8662d973d9b05a70b3c35df1f91fe419b84749", size = 22640, upload-time = "2026-10-02T23:05:00.768Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/09/b2/1506df394f0f075797c418d0301498f49e43be194e3ffcb49e6fe6ccf022/markupsafe-3.0.4-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:64511c54db4e4987aef4c41923235927428729e8174c5dba488429be70a998ed", size = 24074, upload-time = "2026-10-02T23:05:01.813Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c7/81/5ed69cda630ac69ef60d06c09ba5a7f84ff66a2e28cf986fd5614ab3c6e6/markupsafe-3.0.4-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:e1a622f13970d81f95d0c72f9dc090dce9085fccfa4c9f2174377ee32bd15786", size = 21563, upload-time = "2026-10-02T23:05:03.239Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/0c/fe/fb1e79be0fea60aa32602ebefc9c35a82bb42b4df157285ab7dfec12341a/markupsafe-3.0.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:c9a7f43c0b202b334cc9184af09bb8f21d3a209e038efaf106936fb69e6b026e", size = 23048, upload-time = "2026-10-02T23:05:04.479Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c8/52/7632a53360671a9b750cdbabaf9cdd89f18b42248b8e4cb42c0b0296e459/markupsafe-3.0.4-cp312-cp312-win32.whl", hash = "sha256:f0ec3b750b59375eab5b0fb2b9254810c00a3375be6d789899f1055a1d556237", size = 14108, upload-time = "2026-10-02T23:05:05.513Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/3f/bf/62495e180b7000aaf30000fff849e933f74264638057176cf46852500adc/markupsafe-3.0.4-cp312-cp312-win_amd64.whl", hash = "sha256:11935df9bf455ed0c04eb87bcd720f02b1fe5e02128a9430f23aed6f93336fc7", size = 14303, upload-time = "2026-10-02T23:05:06.538Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c5/8e/4c24208776a65878d656996945aacfbfe010d3720d1a98fc0eb8491fc03b/markupsafe-3.0.4-cp312-cp312-win_arm64.whl", hash = "sha256:a4bbd2d87dd233b9fc5812160c3d0ffbe42edc22a26ce0469f58479ede633fe9", size = 14174, upload-time = "2026-10-02T23:05:07.617Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/6d/18/4bc5ba32499e87bb2b0ef5b3a9bb9c00a131fa961ddf0be548cb550f548b/markupsafe-3.0.4-cp313-cp313-android_24_arm64_v8a.whl", hash = "sha256:de8b364c423ef0a4bad9069657d617f9a5d2b2062457a89b1fa16ee199c399c1", size = 12786, upload-time = "2026-10-02T23:05:08.709Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/4e/6f/17f0c099bf25f3e31e63cc19244d9f6af861a9a4ab778c203997903cfdd0/markupsafe-3.0.4-cp313-cp313-android_24_x86_64.whl", hash = "sha256:34bdde374c5932765d7dc685c4a1d191a3207852d67e8e0a9eb6ea85156181f1", size = 12510, upload-time = "2026-10-02T23:05:09.93Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/11/af/1a141081b905036ee904ec4bd945e1f70b4e1b32d33c4e59e8cf1d58b247/markupsafe-3.0.4-cp313-cp313-ios_13_0_arm64_iphoneos.whl", hash = "sha256:6bd9e1788e15bfcf6a9082de42e30387e7b85d211ab21e57a939bb8cfaaf8d96", size = 11583, upload-time = "2026-10-02T23:05:10.884Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/e7/0a/a89385ae590232622a03e091805cff12f24fabe6c11e0e8bae096cece81c/markupsafe-3.0.4-cp313-cp313-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:5066b244f576f91afc8ee3ba029a89f99d39c79b1853fe9d39bea9f0afbec148", size = 11801, upload-time = "2026-10-02T23:05:11.913Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ed/85/ea548dc013962eb73653124bc595635fbf9e0fa41d1f181a967ccb784dfb/markupsafe-3.0.4-cp313-cp313-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:7a83aa6e4805df46fed18e989d3d16f86ef60cb50bbc8d9ce3a6be89165fbf6e", size = 11443, upload-time = "2026-10-02T23:05:12.887Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/cc/72/15f2e5ec9cf2eb00d5cdfe968d94e4156a7bd7303832c3f3b2c403a36839/markupsafe-3.0.4-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:2d1b7d9308288661f56672b1b157d75fc536714d3638487bbea17b6318a78248", size = 11665, upload-time = "2026-10-02T23:05:13.829Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ca/e0/4030bea613677e333c8a2c901fd405055f657f9d06acba5b7357984b6ef7/markupsafe-3.0.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:73e77980c7207854f00fc4e71fb1626868d5740ab4012623d55c7a99ad122a72", size = 12061, upload-time = "2026-10-02T23:05:14.807Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/f3/a5/28b76a7449eb702966b88bef599e2360b411fbb3afeee8fe560939be06ec/markupsafe-3.0.4-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:7018d4af1cd272e847aa5917983ab5e83e4f6579f9dbfecd4a79c0ca80b144c2", size = 24395, upload-time = "2026-10-02T23:05:15.909Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/07/6c/21232811afc3a063b5e934b1ae2efda52f46154ec382f585149c020e61fe/markupsafe-3.0.4-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:c90d5b3d4e944e065a301d741b3c1d784f6bd1f503aa68b4967e32b2ba313d85", size = 27183, upload-time = "2026-10-02T23:05:16.976Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/14/38/6ccdfa5b59049cb36fb80cbc80aee9cf1fc9bb77d1335ad435f2070b08cf/markupsafe-3.0.4-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:18a801868a884f216e784d7d14db2a4077143ce7610440aee2ce8f734e7cfcde", size = 24772, upload-time = "2026-10-02T23:05:18.209Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/63/e0/cec6865dfe88cb48fedd4b20aed6af5158e41092adcbf3e028bcc6ec2108/markupsafe-3.0.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:434139499bb20b502ed3baa1f169e618f924a97e7a777fea1a49446d80106cf6", size = 23017, upload-time = "2026-10-02T23:05:19.286Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ee/76/6ed4940bb7648a9aac457c14f870cfdd5105f139a0fb1f29cd61fafa47d1/markupsafe-3.0.4-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:9e227f3dbe6bde7491cf0a9965d00b88c6b1a4a95d11480ddf88bb96d397c19f", size = 22036, upload-time = "2026-10-02T23:05:20.352Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/a1/4f/ed476226d4fe46a09090a36025bf319296810028df55eb12f1253b540f3a/markupsafe-3.0.4-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:b8cd1f918b26fd7b1832ece557cc18f2d8747309ff8b3f0ef9d4250c5ad67a39", size = 23786, upload-time = "2026-10-02T23:05:21.576Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/9a/35/66ff30450e35ef5fba9ebc930c9411747e537fd9447b65e44f5007e2b84d/markupsafe-3.0.4-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:a5fcffb37e602b0b3c1638a97746b9b96125caa9bcf6fa41d337a9261de231ee", size = 22672, upload-time = "2026-10-02T23:05:22.922Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/32/0b/72f45ce4b4efcbca4b80cf1b06703eff0be8d37e82abb78f66c85a7ead1e/markupsafe-3.0.4-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:5989cb26b2e1efc6a42216a9f6b5ee495ce5ace2e5b352a9af489976b32d1ee2", size = 24107, upload-time = "2026-10-02T23:05:24.175Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d2/03/71776e5fdcba04614b384cc102e8a4198208579d896fd1394cb7cb9aa900/markupsafe-3.0.4-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:add96447a86d205ab616665d53b2950ee81083757f56e6ea833c8b2917646b46", size = 21615, upload-time = "2026-10-02T23:05:25.215Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ab/5f/801ce02a02e7aee0f784b1ec7843026178f6adeb9c93ac67eb1992a9a84d/markupsafe-3.0.4-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:2628d3a8cb648ecebb3c5d6b0a1052d400e4d8b7ac0fb786be8d285b50040d17", size = 23076, upload-time = "2026-10-02T23:05:26.423Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/4a/85/c43776625428f3bb4a61e8633940400e3efe6409e3c6f5bff26de5e45618/markupsafe-3.0.4-cp313-cp313-win32.whl", hash = "sha256:672d207103e6b16ca098611b0f9efad6bc00afd47c03d6ef62186495ca677dc0", size = 14118, upload-time = "2026-10-02T23:05:27.716Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/6f/36/163da64de88a13db79214ef75fa041be7fa13bdb42261cf5b7484de14bfb/markupsafe-3.0.4-cp313-cp313-win_amd64.whl", hash = "sha256:1f1f9477e174582b0a1b583d60b66e1f2cf5d3fe12cee985e4aedf44766600e5", size = 14313, upload-time = "2026-10-02T23:05:28.749Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/9f/a8/9b662783ffaa1149221432a923cee562f78b9cbbb8baa3df9b3753e63e1e/markupsafe-3.0.4-cp313-cp313-win_arm64.whl", hash = "sha256:06de8ef6331f6e822c28d577dc8bf43fe398800477c49498f38fc38b67ff33fc", size = 14189, upload-time = "2026-10-02T23:05:29.917Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/5c/c3/a944f3b0df22bd129e96915b9f4e98d2eeca6516687d7618304a966c3c74/markupsafe-3.0.4-cp314-cp314-android_24_arm64_v8a.whl", hash = "sha256:4ed644d75aa94a2baf7ec3a96eaa160ea58c742eb9d27c6506053c5c40fc84ed", size = 12787, upload-time = "2026-10-02T23:05:30.971Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d4/d6/a44863f69d88b6c7e27889108f70d47aed259edf89d5df3c5fca1eac87d6/markupsafe-3.0.4-cp314-cp314-android_24_x86_64.whl", hash = "sha256:6d2a9efe686f9de00d0d1ea32a4a5a86d558a2277501bd78d964214eab625e59", size = 12525, upload-time = "2026-10-02T23:05:32.263Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/17/8f/168ba80e532dd6a93f96f8f706f1ad41d7990b6e1aeedc1cc0d211a33497/markupsafe-3.0.4-cp314-cp314-ios_13_0_arm64_iphoneos.whl", hash = "sha256:8781a792a070cf2bd1b86d3aa943894115faaba6e88122a7bf32d62072742453", size = 11589, upload-time = "2026-10-02T23:05:33.251Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/32/b3/aa2c95a574d3af39403a469b295886eb9b6d448da568cbebb5a2cbfdc2e5/markupsafe-3.0.4-cp314-cp314-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:971a3bbb75d97ae4e2e8f7d4834236f86f85f0c85e04ab2e191db1123b04f80b", size = 11801, upload-time = "2026-10-02T23:05:34.315Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/60/d0/34b810107d83840e768bf485de795893ebbae35b26ab061b487adfa0a692/markupsafe-3.0.4-cp314-cp314-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:8909c2f1c6dd65e054ac4b573a91c8384d1492281e55d82d159d653f7a13adf6", size = 11447, upload-time = "2026-10-02T23:05:35.302Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/6c/ab/2f8488f0f817a39fca068d2b17daf446bf5cdb3eae28c3720af534d873b4/markupsafe-3.0.4-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:4cf3468d5ec187ffffcaca8e61929a37448f215dafc1386a12c750a72fe53634", size = 11722, upload-time = "2026-10-02T23:05:36.363Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ad/40/e2d117b048d47282ade906fbfd92814cbee5647afc13fda88a3406039372/markupsafe-3.0.4-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:52704c5d36eb6dda8866493decd61111fff86244c9b1ad225ca01b9e91e5970f", size = 12061, upload-time = "2026-10-02T23:05:37.397Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/9a/a8/73a81135e85ba66217f5af7facb03bbb386807e1a729ab64532e4c802652/markupsafe-3.0.4-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1caa2fa5a6184fb233153b35f654e6687bd555476f6170f29d8ee9be1a8b0af9", size = 24434, upload-time = "2026-10-02T23:05:38.407Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ac/ca/fa9216dd01efee2dfdacafe7df32b4d0170fbac694b0c258a193d6e53999/markupsafe-3.0.4-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:387d8cd30e69b3f0a72877b9ae717033396404e19095b17fe89753a981fda44f", size = 27183, upload-time = "2026-10-02T23:05:39.581Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/fa/4e/a469509e538d37af51103b17b073126973f2b1cbf197ff32c7ddf025cfe5/markupsafe-3.0.4-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:051417f74bcaaefa316276e0ff723f541616ca51043d070da00249d9bddd3e3c", size = 24813, upload-time = "2026-10-02T23:05:40.671Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/8f/db/d7282caf7ab03af44d5d6fdbaa019b35c7d7f1c90588b839c07cba640d6a/markupsafe-3.0.4-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a8e9f292fcda89b324f2f5c91d13f1424a153e40fc2756f38ee23b15835ff300", size = 23049, upload-time = "2026-10-02T23:05:41.864Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/30/f3/b6a425206e6964efda6acee544d0eb01d1501784d0b8e2dcc74986f33b17/markupsafe-3.0.4-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:df1ae86ff54725a01fa1a0510b914ca53a161b7050be74f6204e24aded5971d0", size = 22088, upload-time = "2026-10-02T23:05:43.014Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ea/8a/84d3582fc1f0d5bd466cdf2eebf175e172158a6e70701aacec1de1b35430/markupsafe-3.0.4-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:8965520ac587c94a4ac48b729be3d8b8de00af39699b17585dfb599babe77977", size = 23846, upload-time = "2026-10-02T23:05:44.098Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/1c/65/db101cce51b7ba4864ac491a9859d297dd1adf0e55b103fee9db9c47c527/markupsafe-3.0.4-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:340cbb1957ba99929cbf19a75626d36ba1ae21d1730b287d1cf7f824a20c4fc7", size = 22674, upload-time = "2026-10-02T23:05:45.23Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/e0/49/ddee9813d71db0c7a5c9d97c832125e6758a0c844777f1cf076569bb0e22/markupsafe-3.0.4-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:3a93d9616ddecfb393727a0041a562cf0b15a244e20f2bd25efc7949be4c4f17", size = 24104, upload-time = "2026-10-02T23:05:46.398Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/aa/0e/7d8518d726726870a2399d69fd30d0fa36c5e57a2132c336b58d7c491073/markupsafe-3.0.4-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:d2e56fd3b00222722abfb3f5f0759ddbae4b90811b5ad4343c64030ad1bde70c", size = 21637, upload-time = "2026-10-02T23:05:47.48Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/b4/b0/b505e8a361ba557dbf3b3aa7331ea39b00d2022a26e925ff8463b9714bb3/markupsafe-3.0.4-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:0d9c47709875fdb321452056622e930c52afbc07a7d780762fbb8b4d91ce6fa4", size = 23081, upload-time = "2026-10-02T23:05:48.611Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/1c/ea/9cc3cea873f980c75cbdb6f4277ce30ee955de38be0b3d02f14c108e0698/markupsafe-3.0.4-cp314-cp314-win32.whl", hash = "sha256:38fc55594dab834470b6733dead2ee9e3f657fb0608c769dcafa0ba5ab52f45c", size = 14272, upload-time = "2026-10-02T23:05:49.707Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/80/f0/5792ff768a410f93ee3f84fc19345295ffc352d2c936b424cb37e514714c/markupsafe-3.0.4-cp314-cp314-win_amd64.whl", hash = "sha256:c1bc67752d5f21013cfe430df4062441714eab79f65a6a05e01505957e9c35fe", size = 14501, upload-time = "2026-10-02T23:05:50.788Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/5f/cf/3d074a8edffcc6899355232ff2543ae8d929733239596423b7db79698bc9/markupsafe-3.0.4-cp314-cp314-win_arm64.whl", hash = "sha256:7e1636da3d8dfc220b6dd10264db5f2b165e4888c4518594898fbe381049af8a", size = 14364, upload-time = "2026-10-02T23:05:51.857Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d9/31/87ce42159aae2163cf3bbbd0c44bc87780510eecab1ea3859099aed95dcb/markupsafe-3.0.4-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:805c8b84534fa10891890f0e4be39f3a99e94615d93e8836bf9fa1fdca2feeb2", size = 11759, upload-time = "2026-10-02T23:05:52.951Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/5f/53/b047207eeb7752e960aca3eb1df5fb7eefa7dd4c62ac49bb156456c8a702/markupsafe-3.0.4-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:fa95848c929b6a75f6848d3c9793e59db365ee436776e57db835cdbfa79ba977", size = 12096, upload-time = "2026-10-02T23:05:54.066Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ee/51/4326c88a13c7b755657d44b4bb986f8c3d9843ecba7e22d98661d87f9a57/markupsafe-3.0.4-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e916035e3e9930cbdfdd10abf48861340221857f45509565898e012263f7b289", size = 25699, upload-time = "2026-10-02T23:05:55.15Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/f2/bb/990581b7474bfcf2cf34bed6ba5ea23bd87adb9d671213d68e88620e7a6b/markupsafe-3.0.4-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:b4d12837e0203bbace818ff4a7461afdcd78bcd782351cea148139180d7bcffe", size = 27804, upload-time = "2026-10-02T23:05:56.29Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/6b/89/89491878c28e8291f5aa2fffe2c2d57230d10ae366d55dd810b840513d78/markupsafe-3.0.4-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:5086f9975abb1ab531ee6afca1761e4b59a19b446f3f6522ed776963228cfe5a", size = 25912, upload-time = "2026-10-02T23:05:57.416Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/30/77/680998b54efdea06fc114565cd739b6d059f826a0279219b218dfa750d29/markupsafe-3.0.4-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b4a635a0487774f841cb1fb62e907e7195cc95bc761e053184b8acc3ceb20733", size = 23623, upload-time = "2026-10-02T23:05:58.557Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ae/75/2709f5ac5de9467b40b10e2bb8f89cc63dfb74582e09aa734b1124a217de/markupsafe-3.0.4-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:cb96e6e088d6cf71c1ea977510948320234824cf226e32f6f6e044f7a9c82b34", size = 23301, upload-time = "2026-10-02T23:05:59.94Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/a0/c8/39eadc6c5b14c9c7679bfb98f4d4c6a97863b5beb91839aca4d2d6e16e55/markupsafe-3.0.4-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:8b5d563170ff8ba3181caa967c99a3c804d1dedb702c7cb93a6a7c32247da978", size = 24950, upload-time = "2026-10-02T23:06:01.289Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/1a/5e/01037f8a43e8ccb0bffb4fbdc5212db05bf080fdd7286cd392332d58128a/markupsafe-3.0.4-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:396ec4e65cc889f69786b3b89478b471cee5a3bcf468b9d9bb03e1a30fb291fc", size = 23330, upload-time = "2026-10-02T23:06:02.441Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d4/f4/23e83ce0596bb0cbe670502d31df8f757bbd01a392aa486fa3b40d1ed399/markupsafe-3.0.4-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:15ba9e28640feef770374b116a6f019c21f52404aeabe516aa7f800587b98cfc", size = 25239, upload-time = "2026-10-02T23:06:03.579Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/88/5b/3708897368073cc683d524750474f41a77d2986152c380dcc55b20fdf340/markupsafe-3.0.4-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:d920abdfa61279ba1a2ef9484aab07bf03331f8c08a10120fa332353d06e6932", size = 22767, upload-time = "2026-10-02T23:06:04.699Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c6/61/ebda1307864b409e6b3115757a3d4a09cca46cfb6cc65191b5de226b424b/markupsafe-3.0.4-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:a9f54054101545a9a9cccefddf54316aa6e4491611fcbef9e91b3b6bebec04f6", size = 23668, upload-time = "2026-10-02T23:06:05.9Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/09/15/98075cceac3b5ba0dbb8e4762a847be967d2befc349a2cf2d0ac77f62c9d/markupsafe-3.0.4-cp314-cp314t-win32.whl", hash = "sha256:12a606a492de952afcb43b59a14aaaaad120e708d3663dd0fdf2d738d427a691", size = 14301, upload-time = "2026-10-02T23:06:07.109Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/0b/a3/768b560fcc4156685cb563d922b217810cfa7bc135773367f62f1f9d2078/markupsafe-3.0.4-cp314-cp314t-win_amd64.whl", hash = "sha256:a18f38cafc329bac5e3c2b96c765b4c96d3d103421ed22ab7988c1e3fce27464", size = 14526, upload-time = "2026-10-02T23:06:08.276Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/93/63/da554b4c97a6b0ea3229ca7fe8cbfb620be81613d517f482e85958550537/markupsafe-3.0.4-cp314-cp314t-win_arm64.whl", hash = "sha256:eba154571c16e032112afac0dc2dfe9e63c2ceb7aedd07bb7eecf2ce26d4dd4c", size = 14421, upload-time = "2026-10-02T23:06:09.402Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/a9/30/54d11c8ca027114898cab97421fb39e4ffd9ddf47cdbc44df2ec76722da9/markupsafe-3.0.4-cp315-cp315-android_24_arm64_v8a.whl", hash = "sha256:737c9c3981998eba27f11786f84fddcbabc74068b72a4a1f454ea02094b57b65", size = 12791, upload-time = "2026-10-02T23:06:10.485Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/10/6d/97c913e253a14bd3cd0e15a5c56d13203b823fa7ee32498342896a072dc4/markupsafe-3.0.4-cp315-cp315-android_24_x86_64.whl", hash = "sha256:489505b03f692c3f376394e49194fa7a7f9e8558d6e293a7056a0032b0c38163", size = 12527, upload-time = "2026-10-02T23:06:11.834Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/26/f9/b86d032042a4d597d9e1997f0e5f63a3eedaf11258e0a05760b0a0a826ea/markupsafe-3.0.4-cp315-cp315-ios_13_0_arm64_iphoneos.whl", hash = "sha256:077293e425f28ec737dbcad442a71752e28f8ae27cde3d68acd1fb212091cd92", size = 11602, upload-time = "2026-10-02T23:06:13.122Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/f2/dc/73c14c1eedf0ac5fa3292ba43435e6c49d2c2050f33cebde541f8f4807f1/markupsafe-3.0.4-cp315-cp315-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:9348cbb300d224fe3b89793262cb093504d4ae927004468463f745188a193e4a", size = 11817, upload-time = "2026-10-02T23:06:14.227Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/8f/69/2c2fcaa5fcee22d72c7819c0d536fd181c74a688e6143845419579cd2863/markupsafe-3.0.4-cp315-cp315-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:b807e598953730f82e4eae3bd30f6a122cf6b31c398c6b504c0e04c13c170429", size = 11446, upload-time = "2026-10-02T23:06:15.574Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/88/54/9e5ec76c62e6e2834d5a93623018c943e8b3bb41d663e3fd4c03303b9b85/markupsafe-3.0.4-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:799c39bdf5e2f1292fedd3009f7b3c9e760f10b2420cb9638d56920840ff6db8", size = 11719, upload-time = "2026-10-02T23:06:16.701Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/96/24/3ec292b44064c16229e064d770b2625bd8ea941aa61f44905a9fa44942c0/markupsafe-3.0.4-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:ae9dcb8fbe244cb82f8a6458b455b927a03685e383d9bacf1ea5ce180b96dc97", size = 12075, upload-time = "2026-10-02T23:06:17.855Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/aa/85/b64fdb1f304848518742136983c24e96d967bfb59a0ea160e92736901ab0/markupsafe-3.0.4-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4bced6e2a6dba6a28f7dd3c6ce14df1b2dd495923f16ea484cad03decd463b2b", size = 24656, upload-time = "2026-10-02T23:06:18.963Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/9c/18/23997d4c65b355da6390d61cd56e0ab3befd6ba8dda25cb40c602bd0fa6b/markupsafe-3.0.4-cp315-cp315-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:3882fb412298575bae3b9c46868251f15cc69307359f87bb1b382e53d6e5a2c9", size = 27737, upload-time = "2026-10-02T23:06:20.117Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d4/36/35998dead3c6af88c38265a56e58100211f036234ab88eb2283fd4cbce44/markupsafe-3.0.4-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:04e7902ba80ee4bac1d50a549606527a1dcf0476cd81403db41099d3b60ec653", size = 25003, upload-time = "2026-10-02T23:06:21.284Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/82/96/ef49135ce260db4ca4a12b119ed468449cd248db6b1468e2112b546d7a2e/markupsafe-3.0.4-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:925f929d6b59a8b3f8b8c6ac363cd0af7eecc81efb3071770b3c6717c450a369", size = 23111, upload-time = "2026-10-02T23:06:22.524Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/50/7d/83126e338bd88c17a220668235368ad719fd4638e426739858cbb8508f77/markupsafe-3.0.4-cp315-cp315-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:f68edfc67aabac33708941f26f22a7b8e9f81429bc0cf249fcf7d66b23af8d19", size = 22403, upload-time = "2026-10-02T23:06:23.785Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/83/dd/daf7e420de23c8206c365204e7b85e1251d8e19d34196a56336f316e5ed2/markupsafe-3.0.4-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:e5c802729725bd07e2bc3ab7b76dc7e0bbfc53129d8f1eb1c002c24cf774717e", size = 24083, upload-time = "2026-10-02T23:06:25.037Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/19/3c/11eecdc06bc44ad5570350085b572ebf049e8f9a38d1ece6d76640b739cd/markupsafe-3.0.4-cp315-cp315-musllinux_1_2_armv7l.whl", hash = "sha256:55ffd6ce583d97dc71dc92e930324c8c0d25aea7e3ade6ae54ef77cedb096811", size = 22931, upload-time = "2026-10-02T23:06:26.328Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/0d/9e/ac0fd77f2a726e56ecc3ca0235d095feace1358d1b822406c2a2ef26a4dc/markupsafe-3.0.4-cp315-cp315-musllinux_1_2_ppc64le.whl", hash = "sha256:2cb3dd71fc6be918ad4264346a8ed69485f9b7ed7bf35495d8e22807cd6b8bea", size = 24299, upload-time = "2026-10-02T23:06:27.742Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d7/09/c6bd842ad58ff5b3bc76eeed7e9a42a6f11adc5d090ec697b72c9672731e/markupsafe-3.0.4-cp315-cp315-musllinux_1_2_riscv64.whl", hash = "sha256:94f5407f7bc64fa6463906b896f9904beeeb7dd8dc116ee8e9056c8714ff9916", size = 21948, upload-time = "2026-10-02T23:06:29.274Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/a3/46/82f586711fed61e86faa1ee1bc317d68cd45a10c8bdbe3f7d1fdf9026ad8/markupsafe-3.0.4-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:2dad610540cb2e6272855c178f08ae9a1c7ac258a7fb71660553a5f104b42741", size = 23150, upload-time = "2026-10-02T23:06:30.583Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/19/2d/2dfdce99318abbfa26925195fbc17db188c46a1ec6457be121b6f9cfeb42/markupsafe-3.0.4-cp315-cp315-win32.whl", hash = "sha256:03470d1a8268e692ecf79ecd565593e59d44219377a7ead61f1f1b94c1f7ff6b", size = 14269, upload-time = "2026-10-02T23:06:31.949Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/5b/ec/6000fd82e8791e58fcd0456ec20f098957e2b03d5ed02eb73241a577c0ba/markupsafe-3.0.4-cp315-cp315-win_amd64.whl", hash = "sha256:d882a373d8093c2941e01291b7ced96e9cbe4781da9a7751ca7e6c70385e5214", size = 14496, upload-time = "2026-10-02T23:06:33.258Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/bc/66/e73bd5016421d5d6e2fb6de7dd609f9de020942ac8c626526bd8c6eeaf82/markupsafe-3.0.4-cp315-cp315-win_arm64.whl", hash = "sha256:353bd63081912ab8cfa6a0c7d185934cdf8426f04c618bba6bc4b394f2069b67", size = 14361, upload-time = "2026-10-02T23:06:34.539Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/90/df/cb8c3dc98d313a951df2f8968f44e4cb5643df6d3cab749a530ce2f7d972/markupsafe-3.0.4-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:c61750fadcd119d0825bcb7d7d675dd264dcc89cc05292aab5be68ebdbb374ad", size = 11760, upload-time = "2026-10-02T23:06:35.807Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d6/bb/4af9b3ca0753d654ac75f9531d5bd741bb77ca6e696f36807c475ffc099a/markupsafe-3.0.4-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:1c0df495a977d10460a94941799c72d5b5ab03d3858d949b55b5a66c8f371c99", size = 12108, upload-time = "2026-10-02T23:06:37.089Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/3f/d4/b56429313aee5fd59b079c3df5615299959e25e7113eb6d8caadbdd7d38a/markupsafe-3.0.4-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:02fa4acbc6a3fc5c693c34d4dd8c1130b7fe99cc915181b0ddd6f72aeb296002", size = 25762, upload-time = "2026-10-02T23:06:38.419Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/65/f5/34c181e891aa4f7d59c918584672e0c5eb7fffe76c1387d1246008bf4081/markupsafe-3.0.4-cp315-cp315t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:05295589e619b9bed252a86b532b8e27350abc372d18ba89b59375325e91ec1e", size = 28400, upload-time = "2026-10-02T23:06:39.819Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ce/b5/ad14694fd0ac9a5ce30bc6498f2999378f418583dd1679cca5a1b512957e/markupsafe-3.0.4-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:be6cb0c799abb0e2ba3e618e6d28ddddf7e485f6c2ce938dfa237daf3905072c", size = 25946, upload-time = "2026-10-02T23:06:41.381Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d6/a8/26b606445387d0ceb1eb1f21840094b84e4e3c3c3983d80d10b89823b490/markupsafe-3.0.4-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:26e9867520db70d37f7fb421a7f0d8adb40171011fb84ce869afa1a83370dfa8", size = 23634, upload-time = "2026-10-02T23:06:42.748Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/39/a2/b8814de672f1f0094d498bf646f2fec9d6356b503d28ef500b71c5095377/markupsafe-3.0.4-cp315-cp315t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:f03460ff076f70ab595bb45a0205ccea1971443575b6920c52e755dec2b3fbfe", size = 23488, upload-time = "2026-10-02T23:06:44.176Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/db/c7/287223376fb73335a3cc5d6eb22c6ab01358cf33945a9c39c06b9dac3f4b/markupsafe-3.0.4-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:436e3ffc6310d3c41878c601db29098102fe5d8a467c49da4a4125254e0980f2", size = 25037, upload-time = "2026-10-02T23:06:45.646Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/f9/29/4df8355e313426d19e62ba33e0253c009ca12a0894ee77d67fa67255361c/markupsafe-3.0.4-cp315-cp315t-musllinux_1_2_armv7l.whl", hash = "sha256:4e2c4809c14559aa7ef426f27fb35afbb38104c349a903bf8f3600456764bb38", size = 23543, upload-time = "2026-10-02T23:06:47.264Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/71/e5/8377731e8495668dcc768f645e717df18318c841edaf023a99395f6da9b4/markupsafe-3.0.4-cp315-cp315t-musllinux_1_2_ppc64le.whl", hash = "sha256:da2af0d7aebfc2074080d72efa6ab8317c62481ef1f896f65d9999c1c01f4494", size = 25282, upload-time = "2026-10-02T23:06:48.795Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ed/5f/373456e37ceb1478d657d6fe769cbe0a39f0a8dfc1548eeb19c471eefdd9/markupsafe-3.0.4-cp315-cp315t-musllinux_1_2_riscv64.whl", hash = "sha256:aa2c838cc024642cc04c6854232f32b43e5e22833dd11119c1766c7873b8370d", size = 22993, upload-time = "2026-10-02T23:06:50.31Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d7/93/2cbd5628435afb6f541bbaced4bce0c2edac4b09a142e6e928b8b0da9858/markupsafe-3.0.4-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:b91cc9d336957239ff200f30097e6fea2dc6d6fb3c81e853eaa09eac904fd894", size = 23712, upload-time = "2026-10-02T23:06:51.759Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/81/99/157e10966b033b363aeda5263e82596ee232a0b1d082fdbf90aa417ff083/markupsafe-3.0.4-cp315-cp315t-win32.whl", hash = "sha256:e49fb0d1ce92cfa0cb198cc5b1b11cdf9d0638658e2a2db2687e39db7c87fc78", size = 14300, upload-time = "2026-10-02T23:06:53.241Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/33/05/55884815414c9706a23deca150b72c25a62109e65b0b6ce232077802c719/markupsafe-3.0.4-cp315-cp315t-win_amd64.whl", hash = "sha256:4f6e0852a0283b1b1fd776eeb7b766a5f440b3e2bd31ab51af3b400585f3965c", size = 14522, upload-time = "2026-10-02T23:06:54.729Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/92/f9/ecbde7149e95b8a0f18e16d5d747f7dc06049d5da2e4f77f6f5e4a1f46a8/markupsafe-3.0.4-cp315-cp315t-win_arm64.whl", hash = "sha256:39dbacefc411633db5b4378b066a9aca70a3d7e2922c9e578d825f844026eeba", size = 14417, upload-time = "2026-10-02T23:06:56.246Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "notify"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = { editable = "." }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "celery" },
|
||||||
|
{ name = "django" },
|
||||||
|
{ name = "django-ace-editor" },
|
||||||
|
{ name = "django-ninja" },
|
||||||
|
{ name = "jinja2" },
|
||||||
|
{ name = "markdown" },
|
||||||
|
{ name = "pydantic", extra = ["email"] },
|
||||||
|
{ name = "requests" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[package.dev-dependencies]
|
||||||
|
dev = [
|
||||||
|
{ name = "redis" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[package.metadata]
|
||||||
|
requires-dist = [
|
||||||
|
{ name = "celery", specifier = ">=5.6.3" },
|
||||||
|
{ name = "django", specifier = ">=5.0.6,<6" },
|
||||||
|
{ name = "django-ace-editor", specifier = ">=0.1.0" },
|
||||||
|
{ name = "django-ninja", specifier = ">=1.6.2" },
|
||||||
|
{ name = "jinja2", specifier = ">=3.1" },
|
||||||
|
{ name = "markdown", specifier = ">=3.10" },
|
||||||
|
{ name = "pydantic", extras = ["email"], specifier = ">=2.13" },
|
||||||
|
{ name = "requests", specifier = ">=2.34.2" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[package.metadata.requires-dev]
|
||||||
|
dev = [{ name = "redis", specifier = ">=5" }]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "packaging"
|
||||||
|
version = "26.2"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/d7/f1/e7a6dd94a8d4a5626c03e4e99c87f241ba9e350cd9e6d75123f992427270/packaging-26.2.tar.gz", hash = "sha256:ff452ff5a3e828ce110190feff1178bb1f2ea2281fa2075aadb987c2fb221661", size = 228134, upload-time = "2026-04-24T20:15:23.917Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/df/b2/87e62e8c3e2f4b32e5fe99e0b86d576da1312593b39f47d8ceef365e95ed/packaging-26.2-py3-none-any.whl", hash = "sha256:5fc45236b9446107ff2415ce77c807cee2862cb6fac22b8a73826d0693b0980e", size = 100195, upload-time = "2026-04-24T20:15:22.081Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "prompt-toolkit"
|
||||||
|
version = "3.0.52"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "wcwidth" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/a1/96/06e01a7b38dce6fe1db213e061a4602dd6032a8a97ef6c1a862537732421/prompt_toolkit-3.0.52.tar.gz", hash = "sha256:28cde192929c8e7321de85de1ddbe736f1375148b02f2e17edd840042b1be855", size = 434198, upload-time = "2025-08-27T15:24:02.057Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/84/03/0d3ce49e2505ae70cf43bc5bb3033955d2fc9f932163e84dc0779cc47f48/prompt_toolkit-3.0.52-py3-none-any.whl", hash = "sha256:9aac639a3bbd33284347de5ad8d68ecc044b91a762dc39b7c21095fcd6a19955", size = 391431, upload-time = "2025-08-27T15:23:59.498Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pydantic"
|
||||||
|
version = "2.13.4"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "annotated-types" },
|
||||||
|
{ name = "pydantic-core" },
|
||||||
|
{ name = "typing-extensions" },
|
||||||
|
{ name = "typing-inspection" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/18/a5/b60d21ac674192f8ab0ba4e9fd860690f9b4a6e51ca5df118733b487d8d6/pydantic-2.13.4.tar.gz", hash = "sha256:c40756b57adaa8b1efeeced5c196f3f3b7c435f90e84ea7f443901bec8099ef6", size = 844775, upload-time = "2026-05-06T13:43:05.343Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/fd/7b/122376b1fd3c62c1ed9dc80c931ace4844b3c55407b6fb2d199377c9736f/pydantic-2.13.4-py3-none-any.whl", hash = "sha256:45a282cde31d808236fd7ea9d919b128653c8b38b393d1c4ab335c62924d9aba", size = 472262, upload-time = "2026-05-06T13:43:02.641Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[package.optional-dependencies]
|
||||||
|
email = [
|
||||||
|
{ name = "email-validator" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pydantic-core"
|
||||||
|
version = "2.46.4"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "typing-extensions" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/9d/56/921726b776ace8d8f5db44c4ef961006580d91dc52b803c489fafd1aa249/pydantic_core-2.46.4.tar.gz", hash = "sha256:62f875393d7f270851f20523dd2e29f082bcc82292d66db2b64ea71f64b6e1c1", size = 471464, upload-time = "2026-05-06T13:37:06.98Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/e7/08/f1ba952f1c8ae5581c70fa9c6da89f247b83e3dd8c09c035d5d7931fc23d/pydantic_core-2.46.4-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:a396dcc17e5a0b164dbe026896245a4fa9ff402edca1dff0be3d53a517f74de4", size = 2113146, upload-time = "2026-05-06T13:37:36.537Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/56/c6/65f646c7ff09bd257f660434adb45c4dfcbbcebcc030562fecf6f5bf887d/pydantic_core-2.46.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:da4b951fe36dc7c3a1ccb4e3cd1747c3542b8c9ceede8fc86cae054e764485f5", size = 1949769, upload-time = "2026-05-06T13:37:46.365Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/64/ba/bfb1d928fd5b49e1258935ff104ae356e9fd89384a55bf9f847e9193ad40/pydantic_core-2.46.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bb63e0198ca18aad131c089b9204c23079c3afa95487e561f4c522d519e55aba", size = 1974958, upload-time = "2026-05-06T13:37:28.611Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/4e/74/76223bfb117b64af743c9b6670d1364516f5c0604f96b48f3272f6af6cc6/pydantic_core-2.46.4-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f47286a97f0bc9b8859519809077b91b2cefe4ae47fcbf5e466a009c1c5d742b", size = 2042118, upload-time = "2026-05-06T13:36:55.216Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/cb/7b/848732968bc8f48f3187542f08358b9d842db564147b256669426ebb1652/pydantic_core-2.46.4-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:905a0ed8ea6f2d61c1738835f99b699348d7857379083e5fc497fa0c967a407c", size = 2222876, upload-time = "2026-05-06T13:38:25.455Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/b5/2f/e90b63ee2e14bd8d3db8f705a6d75d64e6ee1b7c2c8833747ce706e1e0ce/pydantic_core-2.46.4-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ea793e075b70290d89d8142074262885d3f7da19634845135751bd6344f73b50", size = 2286703, upload-time = "2026-05-06T13:37:53.304Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ba/1e/acc4d70f88a0a277e4a1fa77ebb985ceabaf900430f875bf9338e11c9420/pydantic_core-2.46.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:395aebd9183f9d112f569aeb5b2214d1a10a33bec8456447f7fbdfa51d38d4cd", size = 2092042, upload-time = "2026-05-06T13:38:46.981Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/a9/da/0a422b57bf8504102bf3c4ccea9c41bab5a5cee6a54650acf8faf67f5a24/pydantic_core-2.46.4-cp310-cp310-manylinux_2_31_riscv64.whl", hash = "sha256:b078afbc25f3a1436c7a1d2cd3e322497ee99615ba97c563566fdf46aff1ee01", size = 2117231, upload-time = "2026-05-06T13:39:23.146Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/bd/2a/2ac13c3af305843e23c5078c53d135656b3f05a2fd78cb7bbbb12e97b473/pydantic_core-2.46.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f747929cf940cddb5b3668a390056ddd5ba2e5010615ea2dcf4f9c4f3ab8791d", size = 2168388, upload-time = "2026-05-06T13:40:08.06Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/72/04/2beacf7e1607e93eefe4aed1b4709f079b905fb77530179d4f7c71745f22/pydantic_core-2.46.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:daa27d92c36f24388fe3ad306b174781c747627f134452e4f128ea00ce1fe8c4", size = 2184769, upload-time = "2026-05-06T13:38:13.901Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/9e/29/d2b9fd9f539133548eaf622c06a4ce176cb46ac59f32d0359c4abc0de047/pydantic_core-2.46.4-cp310-cp310-musllinux_1_1_armv7l.whl", hash = "sha256:19e51f073cd3df251856a8a4189fbdf1de4012c3ebacfb1884f94f1eb406079f", size = 2319312, upload-time = "2026-05-06T13:39:08.24Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/7c/af/0f7a5b85fec6075bea96e3ef9187de38fccced0de92c1e7feda8d5cc7bb9/pydantic_core-2.46.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:c1747f85cee84c26985853c6f3d9bd3e75da5212912443fa111c113b9c246f39", size = 2361817, upload-time = "2026-05-06T13:38:43.2Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/25/a4/73363fec545fd3ec025490bdda2743c56d0dd5b6266b1a53bbe9e4265375/pydantic_core-2.46.4-cp310-cp310-win32.whl", hash = "sha256:2f84c03c8607173d16b5a854ec68a2f9079ae03237a54fb506d13af47e1d018d", size = 1987085, upload-time = "2026-05-06T13:39:25.497Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/01/aa/62f082da2c91fac1c234bc9ee0066257ce83f0604abd72e4c9d5991f2d84/pydantic_core-2.46.4-cp310-cp310-win_amd64.whl", hash = "sha256:8358a950c8909158e3df31538a7e4edc2d7265a7c54b47f0864d9e5bae9dcebf", size = 2074311, upload-time = "2026-05-06T13:39:59.922Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/5c/fa/6d7708d2cfc1a832acb6aeb0cd16e801902df8a0f583bb3b4b527fde022e/pydantic_core-2.46.4-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:0e96592440881c74a213e5ad528e2b24d3d4f940de2766bed9010ab1d9e51594", size = 2111872, upload-time = "2026-05-06T13:40:27.596Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ae/6f/aa064a3e74b5745afbdf250594f38e7ead05e2d651bcb35994b9417a0d4d/pydantic_core-2.46.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:e0d65b8c354be7fb5f720c3caa8bc940bc2d20ce749c8e06135f07f8ed95dd7c", size = 1948255, upload-time = "2026-05-06T13:39:12.574Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/43/3a/41114a9f7569b84b4d84e7a018c57c56347dac30c0d4a872946ec4e36c46/pydantic_core-2.46.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7bfb192b3f4b9e8a89b6277b6ce787564f62cfd272055f6e685726b111dc7826", size = 1972827, upload-time = "2026-05-06T13:38:19.841Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ef/25/1ab42e8048fe551934d9884e8d64daa7e990ad386f310a15981aeb6a5b08/pydantic_core-2.46.4-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:9037063db01f09b09e237c282b6792bd4da634b5402c4e7f0c61effed7701a04", size = 2041051, upload-time = "2026-05-06T13:38:10.447Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/94/c2/1a934597ddf08da410385b3b7aae91956a5a76c635effef456074fad7e88/pydantic_core-2.46.4-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:fc010ab034c8c7452522748bf937df58020d256ccae0874463d1f4d01758af8e", size = 2221314, upload-time = "2026-05-06T13:40:13.089Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/02/6d/9e8ad178c9c4df27ad3c8f25d1fe2a7ab0d2ba0559fad4aee5d3d1f16771/pydantic_core-2.46.4-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8c5dac79fa1614d1e06ca695109c6105923bd9c7d1d6c918d4e637b7e6b32fd3", size = 2285146, upload-time = "2026-05-06T13:38:59.224Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/80/50/540cd3aeefc041beb111125c4bff779831a2111fc6b15a9138cda277d32c/pydantic_core-2.46.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f9fa868638bf362d3d138ea55829cefb3d5f4b0d7f142234382a15e2485dbec4", size = 2089685, upload-time = "2026-05-06T13:38:17.762Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/6b/a4/b440ad35f05f6a38f89fa0f149accb3f0e02be94ca5e15f3c449a61b4bc9/pydantic_core-2.46.4-cp311-cp311-manylinux_2_31_riscv64.whl", hash = "sha256:17299feefe090f2caa5b8e37222bb5f663e4935a8bfa6931d4102e5df1a9f398", size = 2115420, upload-time = "2026-05-06T13:37:58.195Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/99/61/de4f55db8dfd57bfdfa9a12ec90fe1b57c4f41062f7ca86f08586b3e0ac0/pydantic_core-2.46.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:4c63ebc82684aa89d9a3bcbd13d515b3be44250dc68dd3bd81526c1cb31286c3", size = 2165122, upload-time = "2026-05-06T13:37:01.167Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/f7/52/7c529d7bdb2d1068bd52f51fe32572c8301f9a4febf1948f10639f1436f5/pydantic_core-2.46.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:aaa2a54443eff1950ba5ddc6b6ccda0d9c84a364276a62f969bdf2a390650848", size = 2182573, upload-time = "2026-05-06T13:38:45.04Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/37/b3/7c40325848ba78247f2812dcf9c7274e38cd801820ca6dd9fe63bcfb0eb4/pydantic_core-2.46.4-cp311-cp311-musllinux_1_1_armv7l.whl", hash = "sha256:18e5ceec2ab67e6d5f1a9085e5a24c9c4e2ac4545730bfe668680bca05e555f3", size = 2317139, upload-time = "2026-05-06T13:37:15.539Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d9/37/f913f81a657c865b75da6c0dbed79876073c2a43b5bd9edbe8da785e4d49/pydantic_core-2.46.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:a0f62d0a58f4e7da165457e995725421e0064f2255d8eccebc49f41bbc23b109", size = 2360433, upload-time = "2026-05-06T13:37:30.099Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c4/67/6acaa1be2567f9256b056d8477158cac7240813956ce86e49deae8e173b4/pydantic_core-2.46.4-cp311-cp311-win32.whl", hash = "sha256:041bde0a48fd37cf71cab1c9d56d3e8625a3793fef1f7dd232b3ff37e978ecda", size = 1985513, upload-time = "2026-05-06T13:38:15.669Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/aa/e6/c505f83dfeda9a2e5c995cfd872949e4d05e12f7feb3dca72f633daefa94/pydantic_core-2.46.4-cp311-cp311-win_amd64.whl", hash = "sha256:6f2eeda33a839975441c86a4119e1383c50b47faf0cbb5176985565c6bb02c33", size = 2071114, upload-time = "2026-05-06T13:40:35.416Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/0f/da/7a263a96d965d9d0df5e8de8a475f33495451117035b09acb110288c381f/pydantic_core-2.46.4-cp311-cp311-win_arm64.whl", hash = "sha256:14f4c5d6db102bd796a627bbb3a17b4cf4574b9ae861d8b7c9a9661c6dd3362d", size = 2044298, upload-time = "2026-05-06T13:38:29.754Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ce/8c/af022f0af448d7747c5154288d46b5f2bc5f17366eaa0e23e9aa04d59f3b/pydantic_core-2.46.4-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:3245406455a5d98187ec35530fd772b1d799b26667980872c8d4614991e2c4a2", size = 2106158, upload-time = "2026-05-06T13:38:57.215Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/19/95/6195171e385007300f0f5574592e467c568becce2d937a0b6804f218bc49/pydantic_core-2.46.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:962ccbab7b642487b1d8b7df90ef677e03134cf1fd8880bf698649b22a69371f", size = 1951724, upload-time = "2026-05-06T13:37:02.697Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/8e/bc/f47d1ff9cbb1620e1b5b697eef06010035735f07820180e74178226b27b3/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8233f2947cf85404441fd7e0085f53b10c93e0ee78611099b5c7237e36aacbf7", size = 1975742, upload-time = "2026-05-06T13:37:09.448Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/5b/11/9b9a5b0306345664a2da6410877af6e8082481b5884b3ddd78d47c6013ce/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:3a233125ac121aa3ffba9a2b59edfc4a985a76092dc8279586ab4b71390875e7", size = 2052418, upload-time = "2026-05-06T13:37:38.234Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/f1/b7/a65fec226f5d78fc39f4a13c4cc0c768c22b113438f60c14adc9d2865038/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5b712b53160b79a5850310b912a5ef8e57e56947c8ad690c227f5c9d7e561712", size = 2232274, upload-time = "2026-05-06T13:38:27.753Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/68/f0/92039db98b907ef49269a8271f67db9cb78ae2fc68062ef7e4e77adb5f61/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9401557acd873c3a7f3eb9383edef8ac4968f9510e340f4808d427e75667e7b4", size = 2309940, upload-time = "2026-05-06T13:38:05.353Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/5f/97/2aab507d3d00ca626e8e57c1eac6a79e4e5fbcc63eb99733ff55d1717f65/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:926c9541b14b12b1681dca8a0b75feb510b06c6341b70a8e500c2fdcff837cce", size = 2094516, upload-time = "2026-05-06T13:39:10.577Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/22/37/a8aca44d40d737dde2bc05b3c6c07dff0de07ce6f82e9f3167aeaf4d5dea/pydantic_core-2.46.4-cp312-cp312-manylinux_2_31_riscv64.whl", hash = "sha256:56cb4851bcaf3d117eddcef4fe66afd750a50274b0da8e22be256d10e5611987", size = 2136854, upload-time = "2026-05-06T13:40:22.59Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/24/99/fcef1b79238c06a8cbec70819ac722ba76e02bc8ada9b0fd66eba40da01b/pydantic_core-2.46.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:c68fcd102d71ea85c5b2dfac3f4f8476eff42a9e078fd5faefff6d145063536b", size = 2180306, upload-time = "2026-05-06T13:40:10.666Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ae/6c/fc44000918855b42779d007ae63b0532794739027b2f417321cddbc44f6a/pydantic_core-2.46.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:b2f69dec1725e79a012d920df1707de5caf7ed5e08f3be4435e25803efc47458", size = 2190044, upload-time = "2026-05-06T13:40:43.231Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/6b/65/d9cadc9f1920d7a127ad2edba16c1db7916e59719285cd6c94600b0080ba/pydantic_core-2.46.4-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:8d0820e8192167f80d88d64038e609c31452eeca865b4e1d9950a27a4609b00b", size = 2329133, upload-time = "2026-05-06T13:39:57.365Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d0/cf/c873d91679f3a30bcf5e7ac280ce5573483e72295307685120d0d5ad3416/pydantic_core-2.46.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:fbdb89b3e1c94a30cc5edfce477c6e6a5dc4d8f84665b455c27582f211a1c72c", size = 2374464, upload-time = "2026-05-06T13:38:06.976Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/47/bd/6f2fc8188f31bf10590f1e98e7b306336161fac930a8c514cd7bd828c7dc/pydantic_core-2.46.4-cp312-cp312-win32.whl", hash = "sha256:9aa768456404a8bf48a4406685ac2bec8e72b62c69313734fa3b73cf33b3a894", size = 1974823, upload-time = "2026-05-06T13:40:47.985Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/40/8c/985c1d41ea1107c2534abd9870e4ed5c8e7669b5c308297835c001e7a1c4/pydantic_core-2.46.4-cp312-cp312-win_amd64.whl", hash = "sha256:e9c26f834c65f5752f3f06cb08cb86a913ceb7274d0db6e267808a708b46bc89", size = 2072919, upload-time = "2026-05-06T13:39:21.153Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c4/ba/f463d006e0c47373ca7ec5e1a261c59dc01ef4d62b2657af925fb0deee3a/pydantic_core-2.46.4-cp312-cp312-win_arm64.whl", hash = "sha256:4fc73cb559bdb54b1134a706a2802a4cddd27a0633f5abb7e53056268751ac6a", size = 2027604, upload-time = "2026-05-06T13:39:03.753Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/51/a2/5d30b469c5267a17b39dec53208222f76a8d351dfac4af661888c5aee77d/pydantic_core-2.46.4-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:5d5902252db0d3cedf8d4a1bc68f70eeb430f7e4c7104c8c476753519b423008", size = 2106306, upload-time = "2026-05-06T13:37:48.029Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c1/81/4fa520eaffa8bd7d1525e644cd6d39e7d60b1592bc5b516693c7340b50f1/pydantic_core-2.46.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:c94f0688e7b8d0a67abf40e57a7eaaecd17cc9586706a31b76c031f63df052b4", size = 1951906, upload-time = "2026-05-06T13:37:17.012Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/03/d5/fd02da45b659668b05923b17ba3a0100a0a3d5541e3bd8fcc4ecb711309e/pydantic_core-2.46.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f027324c56cd5406ca49c124b0db10e56c69064fec039acc571c29020cc87c76", size = 1976802, upload-time = "2026-05-06T13:37:35.113Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/21/f2/95727e1368be3d3ed485eaab7adbd7dda408f33f7a36e8b48e0144002b91/pydantic_core-2.46.4-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e739fee756ba1010f8bcccb534252e85a35fe45ae92c295a06059ce58b74ccd3", size = 2052446, upload-time = "2026-05-06T13:37:12.313Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/9c/86/5d99feea3f77c7234b8718075b23db11532773c1a0dbd9b9490215dc2eeb/pydantic_core-2.46.4-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9d56801be94b86a9da183e5f3766e6310752b99ff647e38b09a9500d88e46e76", size = 2232757, upload-time = "2026-05-06T13:39:01.149Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d2/3a/508ac615935ef7588cf6d9e9b91309fdc2da751af865e02a9098de88258c/pydantic_core-2.46.4-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2412e734dcb48da14d4e4006b82b46b74f2518b8a26ee7e58c6844a6cd6d03c4", size = 2309275, upload-time = "2026-05-06T13:37:41.406Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/07/f8/41db9de19d7987d6b04715a02b3b40aea467000275d9d758ffaa31af7d50/pydantic_core-2.46.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9551187363ffc0de2a00b2e47c25aeaeb1020b69b668762966df15fc5659dd5a", size = 2094467, upload-time = "2026-05-06T13:39:18.847Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/2c/e2/f35033184cb11d0052daf4416e8e10a502ea2ac006fc4f459aee872727d1/pydantic_core-2.46.4-cp313-cp313-manylinux_2_31_riscv64.whl", hash = "sha256:0186750b482eefa11d7f435892b09c5c606193ef3375bcf94aa00ae6bfb66262", size = 2134417, upload-time = "2026-05-06T13:40:17.944Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/7e/7b/6ceeb1cc90e193862f444ebe373d8fdf613f0a82572dde03fb10734c6c71/pydantic_core-2.46.4-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:5855698a4856556d86e8e6cd8434bc3ac0314ee8e12089ae0e143f64c6256e4e", size = 2179782, upload-time = "2026-05-06T13:40:32.618Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/5a/f2/c8d7773ede6af08036423a00ae0ceffce266c3c52a096c435d68c896083f/pydantic_core-2.46.4-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:cbaf13819775b7f769bf4a1f066cb6df7a28d4480081a589828ef190226881cd", size = 2188782, upload-time = "2026-05-06T13:36:51.018Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/59/31/0c864784e31f09f05cdd87606f08923b9c9e7f6e51dd27f20f62f975ce9f/pydantic_core-2.46.4-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:633147d34cf4550417f12e2b1a0383973bdf5cdfde212cb09e9a581cf10820be", size = 2328334, upload-time = "2026-05-06T13:40:37.764Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c2/eb/4f6c8a41efa30baa755590f4141abf3a8c370fab610915733e74134a7270/pydantic_core-2.46.4-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:82cf5301172168103724d49a1444d3378cb20cdee30b116a1bd6031236298a5d", size = 2372986, upload-time = "2026-05-06T13:39:34.152Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/5b/24/b375a480d53113860c299764bfe9f349a3dc9108b3adc0d7f0d786492ebf/pydantic_core-2.46.4-cp313-cp313-win32.whl", hash = "sha256:9fa8ae11da9e2b3126c6426f147e0fba88d96d65921799bb30c6abd1cb2c97fb", size = 1973693, upload-time = "2026-05-06T13:37:55.072Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/7e/e8/cff247591966f2d22ec8c003cd7587e27b7ba7b81ab2fb888e3ab75dc285/pydantic_core-2.46.4-cp313-cp313-win_amd64.whl", hash = "sha256:6b3ace8194b0e5204818c92802dcdca7fc6d88aabbb799d7c795540d9cd6d292", size = 2071819, upload-time = "2026-05-06T13:38:49.139Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c6/1a/f4aee670d5670e9e148e0c82c7db98d780be566c6e6a97ee8035528ca0b3/pydantic_core-2.46.4-cp313-cp313-win_arm64.whl", hash = "sha256:184c081504d17f1c1066e430e117142b2c77d9448a97f7b65c6ac9fd9aee238d", size = 2027411, upload-time = "2026-05-06T13:40:45.796Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/8d/74/228a26ddad29c6672b805d9fd78e8d251cd04004fa7eed0e622096cd0250/pydantic_core-2.46.4-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:428e04521a40150c85216fc8b85e8d39fece235a9cf5e383761238c7fa9b96fb", size = 2102079, upload-time = "2026-05-06T13:38:41.019Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ad/1f/8970b150a4b4365623ae00fc88603491f763c627311ae8031e3111356d6e/pydantic_core-2.46.4-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:23ace664830ee0bfe014a0c7bc248b1f7f25ed7ad103852c317624a1083af462", size = 1952179, upload-time = "2026-05-06T13:36:59.812Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/95/30/5211a831ae054928054b2f79731661087a2bc5c01e825c672b3a4a8f1b3e/pydantic_core-2.46.4-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ce5c1d2a8b27468f433ca974829c44060b8097eedc39933e3c206a90ee49c4a9", size = 1978926, upload-time = "2026-05-06T13:37:39.933Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/57/e9/689668733b1eb67adeef047db3c2e8788fcf65a7fd9c9e2b46b7744fe245/pydantic_core-2.46.4-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:7283d57845ecf5a163403eb0702dfc220cc4fbdd18919cb5ccea4f95ee1cdab4", size = 2046785, upload-time = "2026-05-06T13:38:01.995Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/60/d9/6715260422ff50a2109878fd24d948a6c3446bb2664f34ee78cd972b3acd/pydantic_core-2.46.4-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8daafc69c93ee8a0204506a3b6b30f586ef54028f52aeeeb5c4cfc5184fd5914", size = 2228733, upload-time = "2026-05-06T13:40:50.371Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/18/ae/fdb2f64316afca925640f8e70bb1a564b0ec2721c1389e25b8eb4bf9a299/pydantic_core-2.46.4-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cd2213145bcc2ba85884d0ac63d222fece9209678f77b9b4d76f054c561adb28", size = 2307534, upload-time = "2026-05-06T13:37:21.531Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/89/1d/8eff589b45bb8190a9d12c49cfad0f176a5cbd1534908a6b5125e2886239/pydantic_core-2.46.4-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7a5f930472650a82629163023e630d160863fce524c616f4e5186e5de9d9a49b", size = 2099732, upload-time = "2026-05-06T13:39:31.942Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/06/d5/ee5a3366637fee41dee51a1fc91562dcf12ddbc68fda34e6b253da2324bb/pydantic_core-2.46.4-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:c1b3f518abeca3aa13c712fd202306e145abf59a18b094a6bafb2d2bbf59192c", size = 2129627, upload-time = "2026-05-06T13:37:25.033Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/94/33/2414be571d2c6a6c4d08be21f9292b6d3fdb08949a97b6dfe985017821db/pydantic_core-2.46.4-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:1a7dd0b3ee80d90150e3495a3a13ac34dbcbfd4f012996a6a1d8900e91b5c0fb", size = 2179141, upload-time = "2026-05-06T13:37:14.046Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/7b/79/7daa95be995be0eecc4cf75064cb33f9bbbfe3fe0158caf2f0d4a996a5c7/pydantic_core-2.46.4-cp314-cp314-musllinux_1_1_aarch64.whl", hash = "sha256:3fb702cd90b0446a3a1c5e470bfa0dd23c0233b676a9099ddcc964fa6ca13898", size = 2184325, upload-time = "2026-05-06T13:36:53.615Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/9f/cb/d0a382f5c0de8a222dc61c65348e0ce831b1f68e0a018450d31c2cace3a5/pydantic_core-2.46.4-cp314-cp314-musllinux_1_1_armv7l.whl", hash = "sha256:b8458003118a712e66286df6a707db01c52c0f52f7db8e4a38f0da1d3b94fc4e", size = 2323990, upload-time = "2026-05-06T13:40:29.971Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/05/db/d9ba624cc4a5aced1598e88c04fdbd8310c8a69b9d38b9a3d39ce3a61ed7/pydantic_core-2.46.4-cp314-cp314-musllinux_1_1_x86_64.whl", hash = "sha256:372429a130e469c9cd698925ce5fc50940b7a1336b0d82038e63d5bbc4edc519", size = 2369978, upload-time = "2026-05-06T13:37:23.027Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/f2/20/d15df15ba918c423461905802bfd2981c3af0bfa0e40d05e13edbfa48bc3/pydantic_core-2.46.4-cp314-cp314-win32.whl", hash = "sha256:85bb3611ff1802f3ee7fdd7dbff26b56f343fb432d57a4728fdd49b6ef35e2f4", size = 1966354, upload-time = "2026-05-06T13:38:03.499Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/fc/b6/6b8de4c0a7d7ab3004c439c80c5c1e0a3e8d78bbae19379b01960383d9e5/pydantic_core-2.46.4-cp314-cp314-win_amd64.whl", hash = "sha256:811ff8e9c313ab425368bcbb36e5c4ebd7108c2bbf4e4089cfbb0b01eff63fac", size = 2072238, upload-time = "2026-05-06T13:39:40.807Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/32/36/51eb763beec1f4cf59b1db243a7dcc39cbb41230f050a09b9d69faaf0a48/pydantic_core-2.46.4-cp314-cp314-win_arm64.whl", hash = "sha256:bfec22eab3c8cc2ceec0248aec886624116dc079afa027ecc8ad4a7e62010f8a", size = 2018251, upload-time = "2026-05-06T13:37:26.72Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/e8/91/855af51d625b23aa987116a19e231d2aaef9c4a415273ddc189b79a45fee/pydantic_core-2.46.4-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:af8244b2bef6aaad6d92cda81372de7f8c8d36c9f0c3ea36e827c60e7d9467a0", size = 2099593, upload-time = "2026-05-06T13:39:47.682Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/fb/1b/8784a54c65edb5f49f0a14d6977cf1b209bba85a4c77445b255c2de58ab3/pydantic_core-2.46.4-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:5a4330cdbc57162e4b3aa303f588ba752257694c9c9be3e7ebb11b4aca659b5d", size = 1935226, upload-time = "2026-05-06T13:40:40.428Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/e8/e7/1955d28d1afc56dd4b3ad7cc0cf39df1b9852964cf16e5d13912756d6d6b/pydantic_core-2.46.4-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:29c61fc04a3d840155ff08e475a04809278972fe6aef51e2720554e96367e34b", size = 1974605, upload-time = "2026-05-06T13:37:32.029Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/93/e2/3fedbf0ba7a22850e6e9fd78117f1c0f10f950182344d8a6c535d468fdd8/pydantic_core-2.46.4-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:c50f2528cf200c5eed56faf3f4e22fcd5f38c157a8b78576e6ba3168ec35f000", size = 2030777, upload-time = "2026-05-06T13:38:55.239Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/f8/61/46be275fcaaba0b4f5b9669dd852267ce1ff616592dccf7a7845588df091/pydantic_core-2.46.4-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0cbe8b01f948de4286c74cdd6c667aceb38f5c1e26f0693b3983d9d74887c65e", size = 2236641, upload-time = "2026-05-06T13:37:08.096Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/60/db/12e93e46a8bac9988be3c016860f83293daea8c716c029c9ace279036f2f/pydantic_core-2.46.4-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:617d7e2ca7dcb8c5cf6bcb8c59b8832c94b36196bbf1cbd1bfb56ed341905edd", size = 2286404, upload-time = "2026-05-06T13:40:20.221Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/e2/4a/4d8b19008f38d31c53b8219cfedc2e3d5de5fe99d90076b7e767de29274f/pydantic_core-2.46.4-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7027560ee92211647d0d34e3f7cd6f50da56399d26a9c8ad0da286d3869a53f3", size = 2109219, upload-time = "2026-05-06T13:38:12.153Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/88/70/3cbc40978fefb7bb09c6708d40d4ad1a5d70fd7213c3d17f971de868ec1f/pydantic_core-2.46.4-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:f99626688942fb746e545232e7726926f3be91b5975f8b55327665fafda991c7", size = 2110594, upload-time = "2026-05-06T13:40:02.971Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/9d/20/b8d36736216e29491125531685b2f9e61aa5b4b2599893f8268551da3338/pydantic_core-2.46.4-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:fc3e9034a63de20e15e8ade85358bc6efc614008cab72898b4b4952bea0509ff", size = 2159542, upload-time = "2026-05-06T13:39:27.506Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/1d/a2/367df868eb584dacf6bf82a389272406d7178e301c4ac82545ab98bc2dd9/pydantic_core-2.46.4-cp314-cp314t-musllinux_1_1_aarch64.whl", hash = "sha256:97e7cf2be5c77b7d1a9713a05605d49460d02c6078d38d8bef3cbe323c548424", size = 2168146, upload-time = "2026-05-06T13:38:31.93Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c1/b8/4460f77f7e201893f649a29ab355dddd3beee8a97bcb1a320db414f9a06e/pydantic_core-2.46.4-cp314-cp314t-musllinux_1_1_armv7l.whl", hash = "sha256:3bf92c5d0e00fefaab325a4d27828fe6b6e2a21848686b5b60d2d9eeb09d76c6", size = 2306309, upload-time = "2026-05-06T13:37:44.717Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/64/c4/be2639293acd87dc8ddbcec41a73cee9b2ebf996fe6d892a1a74e88ad3f7/pydantic_core-2.46.4-cp314-cp314t-musllinux_1_1_x86_64.whl", hash = "sha256:3ecbc122d18468d06ca279dc26a8c2e2d5acb10943bb35e36ae92096dc3b5565", size = 2369736, upload-time = "2026-05-06T13:37:05.645Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/30/a6/9f9f380dbb301f67023bf8f707aaa75daadf84f7152d95c410fd7e81d994/pydantic_core-2.46.4-cp314-cp314t-win32.whl", hash = "sha256:e846ae7835bf0703ae43f534ab79a867146dadd59dc9ca5c8b53d5c8f7c9ef02", size = 1955575, upload-time = "2026-05-06T13:38:51.116Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/40/1f/f1eb9eb350e795d1af8586289746f5c5677d16043040d63710e22abc43c9/pydantic_core-2.46.4-cp314-cp314t-win_amd64.whl", hash = "sha256:2108ba5c1c1eca18030634489dc544844144ee36357f2f9f780b93e7ddbb44b5", size = 2051624, upload-time = "2026-05-06T13:38:21.672Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/f6/d2/42dd53d0a85c27606f316d3aa5d2869c4e8470a5ed6dec30e4a1abe19192/pydantic_core-2.46.4-cp314-cp314t-win_arm64.whl", hash = "sha256:4fcbe087dbc2068af7eda3aa87634eba216dbda64d1ae73c8684b621d33f6596", size = 2017325, upload-time = "2026-05-06T13:40:52.723Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ee/a4/73995fd4ebbb46ba0ee51e6fa049b8f02c40daebb762208feda8a6b7894d/pydantic_core-2.46.4-graalpy311-graalpy242_311_native-macosx_10_12_x86_64.whl", hash = "sha256:14d4edf427bdcf950a8a02d7cb44a08614388dd6e1bdcbf4f67504fa7887da9c", size = 2111589, upload-time = "2026-05-06T13:37:10.817Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/fb/7f/f37d3a5e8bfcc2e403f5c57a730f2d815693fb42119e8ea48b3789335af1/pydantic_core-2.46.4-graalpy311-graalpy242_311_native-macosx_11_0_arm64.whl", hash = "sha256:0ce40cd7b21210e99342afafbd4d0f76d784eb5b1d60f3bdc566be4983c6c73b", size = 1944552, upload-time = "2026-05-06T13:36:56.717Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/15/3c/d7eb777b3ff43e8433a4efb39a17aa8fd98a4ee8561a24a67ef5db07b2d6/pydantic_core-2.46.4-graalpy311-graalpy242_311_native-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:90884113d8b48f760e9587002789ddd741e76ab9f89518cd1e43b1f1a52ec44b", size = 1982984, upload-time = "2026-05-06T13:39:06.207Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/63/87/70b9f40170a81afd55ca26c9b2acb25c20d64bcfbf888fafecb3ba077d4c/pydantic_core-2.46.4-graalpy311-graalpy242_311_native-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:66ce7632c22d837c95301830e111ad0128a32b8207533b60896a96c4915192ea", size = 2138417, upload-time = "2026-05-06T13:39:45.476Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/9d/1d/8987ad40f65ae1432753072f214fb5c74fe47ffbd0698bb9cbbb585664f8/pydantic_core-2.46.4-graalpy312-graalpy250_312_native-macosx_10_12_x86_64.whl", hash = "sha256:1d8ba486450b14f3b1d63bc521d410ec7565e52f887b9fb671791886436a42f7", size = 2095527, upload-time = "2026-05-06T13:39:52.283Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/64/d3/84c282a7eee1d3ac4c0377546ef5a1ea436ce26840d9ac3b7ed54a377507/pydantic_core-2.46.4-graalpy312-graalpy250_312_native-macosx_11_0_arm64.whl", hash = "sha256:3009f12e4e90b7f88b4f9adb1b0c4a3d58fe7820f3238c190047209d148026df", size = 1936024, upload-time = "2026-05-06T13:40:15.671Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d7/ca/eac61596cdeb4d7e174d3dc0bd8a6238f14f75f97a24e7b7db4c7e7340a0/pydantic_core-2.46.4-graalpy312-graalpy250_312_native-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ad785e92e6dc634c21555edc8bd6b64957ab844541bcb96a1366c202951ae526", size = 1990696, upload-time = "2026-05-06T13:38:34.717Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/fa/c3/7c8b240552251faf6b3a957db200fcfbbcec36763c050428b601e0c9b83b/pydantic_core-2.46.4-graalpy312-graalpy250_312_native-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:00c603d540afdd6b80eb39f078f33ebd46211f02f33e34a32d9f053bba711de0", size = 2147590, upload-time = "2026-05-06T13:39:29.883Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/11/cb/428de0385b6c8d44b716feba566abfacfbd23ee3c4439faa789a1456242f/pydantic_core-2.46.4-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:0c563b08bca408dc7f65f700633d8442fffb2421fc47b8101377e9fd65051ff0", size = 2112782, upload-time = "2026-05-06T13:37:04.016Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/0b/b5/6a17bdadd0fc1f170adfd05a20d37c832f52b117b4d9131da1f41bb097ce/pydantic_core-2.46.4-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:db06ffe51636ffe9ca531fe9023dd64bdd794be8754cb5df57c5498ae5b518a7", size = 1952146, upload-time = "2026-05-06T13:39:43.092Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/2a/dc/03734d80e362cd43ef65428e9de77c730ce7f2f11c60d2b1e1b39f0fbf99/pydantic_core-2.46.4-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:133878133d271ade3d41d1bfb2a45ec38dbdbda40bc065921c6b04e4630127e2", size = 2134492, upload-time = "2026-05-06T13:36:58.124Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/de/df/5e5ffc085ed07cc22d298134d3d911c63e91f6a0eb91fe646750a3209910/pydantic_core-2.46.4-pp311-pypy311_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:9bc519fbf2b7578398853d815009ae5e4d4603d12f4e3f91da8c06852d3da3e9", size = 2156604, upload-time = "2026-05-06T13:37:49.88Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/81/44/6e112a4253e56f5705467cbab7ab5e91ee7398ba3d56d358635958893d3e/pydantic_core-2.46.4-pp311-pypy311_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:c7a7bd4e39e8e4c12c39cd480356842b6a8a06e41b23a55a5e3e191718838ddf", size = 2183828, upload-time = "2026-05-06T13:37:43.053Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ac/ad/5565071e937d8e752842ac241463944c9eb14c87e2d269f2658a5bd05e98/pydantic_core-2.46.4-pp311-pypy311_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:d396ec2b979760aaf3218e76c24e65bd0aca24983298653b3a9d7a45f9e47b30", size = 2310000, upload-time = "2026-05-06T13:37:56.694Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/4f/c3/66883a5cec183e7fba4d024b4cbbe61851a63750ef606b0afecc46d1f2bf/pydantic_core-2.46.4-pp311-pypy311_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:86e1a4418c6cd97d60c95c71164158eaf7324fae7b0923264016baa993eba6fc", size = 2361286, upload-time = "2026-05-06T13:40:05.667Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/4b/2d/69abac8f838090bbecd5df894befb2c2619e7996a98ddb949db9f3b93225/pydantic_core-2.46.4-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:d51026d73fcfd93610abc7b27789c26b313920fcfb20e27462d74a7f8b06e983", size = 2193071, upload-time = "2026-05-06T13:38:08.682Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "python-dateutil"
|
||||||
|
version = "2.9.0.post0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "six" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/66/c0/0c8b6ad9f17a802ee498c46e004a0eb49bc148f2fd230864601a86dcf6db/python-dateutil-2.9.0.post0.tar.gz", hash = "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3", size = 342432, upload-time = "2024-03-01T18:36:20.211Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ec/57/56b9bcc3c9c6a792fcbaf139543cee77261f3651ca9da0c93f5c1221264b/python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427", size = 229892, upload-time = "2024-03-01T18:36:18.57Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "redis"
|
||||||
|
version = "8.1.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "async-timeout", marker = "python_full_version < '3.11.3'" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/a8/99/604f0b666d4c616d891cf77ebb9db6bb21601344c051aebf1b72b9ff915f/redis-8.1.0.tar.gz", hash = "sha256:6e1a19beef9225c83efd689c7e6b7da2d5215b1f42cd13b7fc3714d0a09c7b25", size = 5254356, upload-time = "2026-07-30T08:51:00.269Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/66/9d/c5731f6e3608663d4d3656fd8d3aecee8b509c3082818f5a13eae925baea/redis-8.1.0-py3-none-any.whl", hash = "sha256:a4fe1aac3d3b3cc791d4b3d5931c5a956045dc951ee74d1c913ee3ac4d2ee9fb", size = 560618, upload-time = "2026-07-30T08:50:58.497Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "requests"
|
||||||
|
version = "2.34.2"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "certifi" },
|
||||||
|
{ name = "charset-normalizer" },
|
||||||
|
{ name = "idna" },
|
||||||
|
{ name = "urllib3" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/ac/c3/e2a2b89f2d3e2179abd6d00ebd70bff6273f37fb3e0cc209f48b39d00cbf/requests-2.34.2.tar.gz", hash = "sha256:f288924cae4e29463698d6d60bc6a4da69c89185ad1e0bcc4104f584e960b9ed", size = 142856, upload-time = "2026-05-14T19:25:27.735Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/a0/f4/c67b0b3f1b9245e8d266f0f112c500d50e5b4e83cb6f3b71b6528104182a/requests-2.34.2-py3-none-any.whl", hash = "sha256:2a0d60c172f83ac6ab31e4554906c0f3b3588d37b5cb939b1c061f4907e278e0", size = 73075, upload-time = "2026-05-14T19:25:26.443Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "six"
|
||||||
|
version = "1.17.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/94/e7/b2c673351809dca68a0e064b6af791aa332cf192da575fd474ed7d6f16a2/six-1.17.0.tar.gz", hash = "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81", size = 34031, upload-time = "2024-12-04T17:35:28.174Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/b7/ce/149a00dd41f10bc29e5921b496af8b574d8413afcd5e30dfa0ed46c2cc5e/six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274", size = 11050, upload-time = "2024-12-04T17:35:26.475Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sqlparse"
|
||||||
|
version = "0.5.5"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/90/76/437d71068094df0726366574cf3432a4ed754217b436eb7429415cf2d480/sqlparse-0.5.5.tar.gz", hash = "sha256:e20d4a9b0b8585fdf63b10d30066c7c94c5d7a7ec47c889a2d83a3caa93ff28e", size = 120815, upload-time = "2025-12-19T07:17:45.073Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/49/4b/359f28a903c13438ef59ebeee215fb25da53066db67b305c125f1c6d2a25/sqlparse-0.5.5-py3-none-any.whl", hash = "sha256:12a08b3bf3eec877c519589833aed092e2444e68240a3577e8e26148acc7b1ba", size = 46138, upload-time = "2025-12-19T07:17:46.573Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "typing-extensions"
|
||||||
|
version = "4.15.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/72/94/1a15dd82efb362ac84269196e94cf00f187f7ed21c242792a923cdb1c61f/typing_extensions-4.15.0.tar.gz", hash = "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466", size = 109391, upload-time = "2025-08-25T13:49:26.313Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/18/67/36e9267722cc04a6b9f15c7f3441c2363321a3ea07da7ae0c0707beb2a9c/typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548", size = 44614, upload-time = "2025-08-25T13:49:24.86Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "typing-inspection"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "typing-extensions" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/55/e3/70399cb7dd41c10ac53367ae42139cf4b1ca5f36bb3dc6c9d33acdb43655/typing_inspection-0.4.2.tar.gz", hash = "sha256:ba561c48a67c5958007083d386c3295464928b01faa735ab8547c5692e87f464", size = 75949, upload-time = "2025-10-01T02:14:41.687Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/dc/9b/47798a6c91d8bdb567fe2698fe81e0c6b7cb7ef4d13da4114b41d239f65d/typing_inspection-0.4.2-py3-none-any.whl", hash = "sha256:4ed1cacbdc298c220f1bd249ed5287caa16f34d44ef4e9c3d0cbad5b521545e7", size = 14611, upload-time = "2025-10-01T02:14:40.154Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tzdata"
|
||||||
|
version = "2026.2"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/ba/19/1b9b0e29f30c6d35cb345486df41110984ea67ae69dddbc0e8a100999493/tzdata-2026.2.tar.gz", hash = "sha256:9173fde7d80d9018e02a662e168e5a2d04f87c41ea174b139fbef642eda62d10", size = 198254, upload-time = "2026-04-24T15:22:08.651Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ce/e4/dccd7f47c4b64213ac01ef921a1337ee6e30e8c6466046018326977efd95/tzdata-2026.2-py2.py3-none-any.whl", hash = "sha256:bbe9af844f658da81a5f95019480da3a89415801f6cc966806612cc7169bffe7", size = 349321, upload-time = "2026-04-24T15:22:05.876Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tzlocal"
|
||||||
|
version = "5.3.1"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "tzdata", marker = "sys_platform == 'win32'" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/8b/2e/c14812d3d4d9cd1773c6be938f89e5735a1f11a9f184ac3639b93cef35d5/tzlocal-5.3.1.tar.gz", hash = "sha256:cceffc7edecefea1f595541dbd6e990cb1ea3d19bf01b2809f362a03dd7921fd", size = 30761, upload-time = "2025-03-05T21:17:41.549Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c2/14/e2a54fabd4f08cd7af1c07030603c3356b74da07f7cc056e600436edfa17/tzlocal-5.3.1-py3-none-any.whl", hash = "sha256:eb1a66c3ef5847adf7a834f1be0800581b683b5608e74f86ecbcef8ab91bb85d", size = 18026, upload-time = "2025-03-05T21:17:39.857Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "urllib3"
|
||||||
|
version = "2.7.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/53/0c/06f8b233b8fd13b9e5ee11424ef85419ba0d8ba0b3138bf360be2ff56953/urllib3-2.7.0.tar.gz", hash = "sha256:231e0ec3b63ceb14667c67be60f2f2c40a518cb38b03af60abc813da26505f4c", size = 433602, upload-time = "2026-05-07T16:13:18.596Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/7f/3e/5db95bcf282c52709639744ca2a8b149baccf648e39c8cc87553df9eae0c/urllib3-2.7.0-py3-none-any.whl", hash = "sha256:9fb4c81ebbb1ce9531cce37674bbc6f1360472bc18ca9a553ede278ef7276897", size = 131087, upload-time = "2026-05-07T16:13:17.151Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "vine"
|
||||||
|
version = "5.1.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/bd/e4/d07b5f29d283596b9727dd5275ccbceb63c44a1a82aa9e4bfd20426762ac/vine-5.1.0.tar.gz", hash = "sha256:8b62e981d35c41049211cf62a0a1242d8c1ee9bd15bb196ce38aefd6799e61e0", size = 48980, upload-time = "2023-11-05T08:46:53.857Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/03/ff/7c0c86c43b3cbb927e0ccc0255cb4057ceba4799cd44ae95174ce8e8b5b2/vine-5.1.0-py3-none-any.whl", hash = "sha256:40fdf3c48b2cfe1c38a49e9ae2da6fda88e4794c810050a728bd7413811fb1dc", size = 9636, upload-time = "2023-11-05T08:46:51.205Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wcwidth"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/2c/ee/afaf0f85a9a18fe47a67f1e4422ed6cf1fe642f0ae0a2f81166231303c52/wcwidth-0.7.0.tar.gz", hash = "sha256:90e3a7ea092341c44b99562e75d09e4d5160fe7a3974c6fb842a101a95e7eed0", size = 182132, upload-time = "2026-05-02T16:04:12.653Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/41/52/e465037f5375f43533d1a80b6923955201596a99142ed524d77b571a1418/wcwidth-0.7.0-py3-none-any.whl", hash = "sha256:5d69154c429a82910e241c738cd0e2976fac8a2dd47a1a805f4afed1c0f136f2", size = 110825, upload-time = "2026-05-02T16:04:11.033Z" },
|
||||||
|
]
|
||||||
Loading…
Reference in New Issue