From ca63101b17905e00903e4b38c595b3adfd4c2b6d Mon Sep 17 00:00:00 2001 From: philomath213 Date: Mon, 15 Jun 2026 16:40:47 +0400 Subject: [PATCH] Seek file to start before hashing so 429 retries sign correctly --- src/bhcli/api/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bhcli/api/__init__.py b/src/bhcli/api/__init__.py index bc631ef..69b6eae 100644 --- a/src/bhcli/api/__init__.py +++ b/src/bhcli/api/__init__.py @@ -66,6 +66,8 @@ def _send(self, method, endpoint, data=None, content_type="application/json"): digester = hmac.new(digester.digest(), None, hashlib.sha256) if data is not None: if isinstance(data, io.BufferedIOBase): + # Seek to the start *before hashing, so the first attempt and any retry are retry-safe + data.seek(0) for chunk in iter(lambda: data.read(65536), b""): digester.update(chunk) data.seek(0)