Реализация лабораторной 2: PostgreSQL, сессии, Valkey-кэш

This commit is contained in:
Tmribob
2026-10-30 19:37:21 +03:00
parent 65003b6119
commit 3df9b09896
44 changed files with 3519 additions and 17 deletions
+26
View File
@@ -0,0 +1,26 @@
"""Errors that may safely be returned through the public API."""
from __future__ import annotations
from typing import Mapping
BASIC_CHALLENGE = 'Basic realm="messenger", charset="UTF-8"'
BEARER_CHALLENGE = 'Bearer realm="messenger"'
class ApiProblem(Exception):
"""An expected API failure with a stable status, machine code and headers."""
def __init__(
self,
status: int,
code: str,
message: str,
headers: Mapping[str, str] | None = None,
) -> None:
super().__init__(message)
self.status = status
self.code = code
self.message = message
self.headers = dict(headers or {})