From 17c33cd101b63bdfa247aa5a650d7afa6e58ffcb Mon Sep 17 00:00:00 2001 From: Alexey Bodanyuk <144894236+wfa22@users.noreply.github.com> Date: Sun, 25 Oct 2026 15:56:29 +0300 Subject: [PATCH] =?UTF-8?q?scripts/demo=5Fattachments.py:=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=B3=D0=BE=D0=BB=D0=BE=D0=B2=D0=BA=D0=B8=20=D0=B1=D0=B5=D0=B7?= =?UTF-8?q?=20=D1=83=D1=87=D1=91=D1=82=D0=B0=20=D1=80=D0=B5=D0=B3=D0=B8?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- scripts/demo_attachments.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/demo_attachments.py b/scripts/demo_attachments.py index 2d1902f..21f98c2 100644 --- a/scripts/demo_attachments.py +++ b/scripts/demo_attachments.py @@ -18,6 +18,7 @@ import sys import urllib.error import urllib.request import uuid +from email.message import Message from pathlib import Path ROOT = Path(__file__).resolve().parents[1] @@ -30,7 +31,7 @@ class Client: self.base = base.rstrip("/") def call(self, method: str, path: str, *, token: str | None = None, body=None, raw: bytes | None = None, - headers: dict | None = None) -> tuple[int, dict, bytes]: + headers: dict | None = None) -> tuple[int, Message, bytes]: h = dict(headers or {}) if token: h["Authorization"] = "Bearer " + token @@ -41,12 +42,12 @@ class Client: req = urllib.request.Request(self.base + path, data=data, method=method, headers=h) try: with urllib.request.urlopen(req, timeout=30) as r: - return r.status, dict(r.headers), r.read() + return r.status, r.headers, r.read() # case-insensitive HTTPMessage except urllib.error.HTTPError as e: - return e.code, dict(e.headers), e.read() + return e.code, e.headers, e.read() -def show(label: str, status: int, headers: dict, payload: bytes, *, binary: bool = False) -> None: +def show(label: str, status: int, headers: Message, payload: bytes, *, binary: bool = False) -> None: inst = headers.get("X-Instance-Id", "-") if binary: text = f"{len(payload)} bytes, Content-Type {headers.get('Content-Type')}"