ЛР3: балансировка API и отказоустойчивость

This commit is contained in:
2026-11-04 17:17:44 +03:00
parent 0ab3a341aa
commit 9633b6e5c0
32 changed files with 1174 additions and 38 deletions
+9
View File
@@ -0,0 +1,9 @@
"""Contract requires RFC3339 UTC timestamps with a literal Z suffix."""
from datetime import datetime, timezone
def utc_z(value: datetime) -> str:
if value.tzinfo is None:
# Database columns are TIMESTAMPTZ, but keep the serializer defensive.
value = value.replace(tzinfo=timezone.utc)
return value.astimezone(timezone.utc).isoformat().replace('+00:00', 'Z')