Skip to content

Commit d77d71b

Browse files
committed
Release Common v3.6.0
1 parent 5725647 commit d77d71b

4 files changed

Lines changed: 19 additions & 11 deletions

File tree

common/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## 3.6.0 - 2026-02-11
4+
5+
### Updated (2)
6+
7+
- Updated `ws_api_payload` function to include the `id` sent in the payload.
8+
- Updated `pyproject.toml` dependencies
9+
310
## 3.5.0 - 2026-01-29
411

512
### Updated (1)

common/pyproject.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "binance-common"
3-
version = "3.5.0"
3+
version = "3.6.0"
44
description = "Binance Common Types and Utilities for Binance Connectors"
55
authors = ["Binance"]
66
license = "MIT"
@@ -15,19 +15,18 @@ python = ">=3.9,<3.15"
1515
requests = ">=2.31.0"
1616
pydantic = ">=2.10.0"
1717
websockets = "^15.0.1"
18-
black = "^25.1.0"
19-
ruff = "^0.12.0"
2018
pycryptodome = "^3.17"
2119
aiohttp = "^3.9"
22-
pytest = { version = ">=6.2.5", optional = true }
2320

2421
[tool.poetry.extras]
2522
dev = ["pytest"]
2623

2724
[tool.poetry.group.dev.dependencies]
2825
tox = "^4.27.0"
29-
pytest = ">=8.4.1"
3026
pytest-asyncio = "^1.0.0"
27+
black = "^25.1.0"
28+
ruff = "^0.12.0"
29+
pytest = ">=8.4.1"
3130

3231
[build-system]
3332
requires = ["poetry-core"]

common/src/binance_common/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ def ws_api_payload(config, payload: Dict, websocket_options: WebsocketApiOptions
651651
if websocket_options.api_key and websocket_options.skip_auth is False:
652652
payload["params"]["apiKey"] = config.api_key
653653

654-
payload["id"] = payload["id"] if "id" in payload else get_uuid()
654+
payload["id"] = payload["params"].pop("id", get_uuid())
655655

656656
payload["params"] = {
657657
snake_to_camel(k): json.dumps(make_serializable(v), separators=(",", ":"))

common/tests/unit/test_utils.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,30 +1381,32 @@ class TestWsApiPayload(unittest.TestCase):
13811381
def setUp(self):
13821382
self.dummy_config = SimpleNamespace(api_key="test-api-key", api_secret="test-api-secret")
13831383
self.base_payload = {
1384-
"id": "123",
13851384
"params": {
13861385
"some_param": "value",
13871386
"list_param": [1, 2, 3],
1388-
"dict_param": {"nested": "data"}
1387+
"dict_param": {"nested": "data"},
1388+
"id": "123",
13891389
}
13901390
}
13911391

13921392
def test_payload_with_api_key_and_signed(self):
13931393
websocket_options = WebsocketApiOptions(api_key=True, skip_auth=False, is_signed=True, signer=None)
1394-
1394+
expected_id = self.base_payload["params"]["id"]
1395+
13951396
with patch("binance_common.utils.websocket_api_signature", return_value={"signed": True}) as mock_signature:
13961397
result = ws_api_payload(self.dummy_config, self.base_payload, websocket_options)
13971398
mock_signature.assert_called_once()
13981399

1399-
assert result["id"] == self.base_payload["id"]
1400+
assert result["id"] == expected_id
14001401
assert result["params"] == {"signed": True}
14011402

14021403
def test_payload_without_api_key(self):
14031404
websocket_options = WebsocketApiOptions(api_key=False, skip_auth=False, is_signed=False, signer=None)
1405+
expected_id = self.base_payload["params"]["id"]
14041406
result = ws_api_payload(self.dummy_config, self.base_payload, websocket_options)
14051407

14061408
assert "apiKey" not in result["params"]
1407-
assert result["id"] == self.base_payload["id"]
1409+
assert result["id"] == expected_id
14081410
assert isinstance(result["params"]["listParam"], str)
14091411
assert isinstance(result["params"]["dictParam"], str)
14101412
assert result["params"]["someParam"] == "value"

0 commit comments

Comments
 (0)