Skip to content

Commit 6d7f794

Browse files
committed
Release common version 1.2.0
1 parent 3d1d7bf commit 6d7f794

File tree

5 files changed

+51
-7
lines changed

5 files changed

+51
-7
lines changed

.github/workflows/release.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Detect all clients
1919
id: detect
2020
run: |
21-
ALL_CLIENTS=$(ls -d clients/*/ | xargs -n 1 basename | jq -R -s -c 'split("\n")[:-1]')
21+
ALL_CLIENTS=$(ls -d clients/*/ | xargs -n 1 basename | jq -R -s -c 'split("\n")[:-1] + ["common"]')
2222
echo "Detected clients: $ALL_CLIENTS"
2323
echo "clients=$ALL_CLIENTS" >> $GITHUB_ENV
2424
echo "::set-output name=clients::$ALL_CLIENTS"
@@ -38,13 +38,14 @@ jobs:
3838
run: |
3939
if [ "${{ matrix.client }}" == "common" ]; then
4040
cd common
41+
old_version=$(git show HEAD^:${{ matrix.client }}/pyproject.toml | grep '^version' | head -1 | sed -E 's/version = "(.*)"/\1/')
4142
else
4243
cd clients/${{ matrix.client }}
44+
old_version=$(git show HEAD^:clients/${{ matrix.client }}/pyproject.toml | grep '^version' | head -1 | sed -E 's/version = "(.*)"/\1/')
4345
fi
4446
45-
old_version=$(git show HEAD^:clients/${{ matrix.client }}/pyproject.toml | grep '^version' | head -1 | sed -E 's/version = "(.*)"/\1/')
4647
new_version=$(grep '^version' pyproject.toml | head -1 | sed -E 's/version = "(.*)"/\1/')
47-
48+
4849
if [ "$old_version" = "$new_version" ]; then
4950
echo "::error ::Version was not bumped in pyproject.toml — skipping release"
5051
exit 1
@@ -76,4 +77,4 @@ jobs:
7677

7778
- name: Publish to pypi
7879
working-directory: ${{ steps.path.outputs.dir }}
79-
run: poetry publish --build --no-interaction
80+
run: poetry publish

common/CHANGELOG.md

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

3+
## 1.2.0 - 2025-08-07
4+
5+
### Changed (1)
6+
7+
- Fixed empty array response handling in `utils.py`.
8+
39
## 1.1.0 - 2025-08-06
410

511
### Changed (2)

common/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "binance-common"
3-
version = "1.1.0"
3+
version = "1.2.0"
44
description = "Binance Common Types and Utilities for Binance Connectors"
55
authors = ["Binance"]
66
license = "MIT"
@@ -11,7 +11,7 @@ packages = [
1111
]
1212

1313
[tool.poetry.dependencies]
14-
python = ">=3.9,<=3.14"
14+
python = ">=3.9,<3.14"
1515
requests = ">=2.31.0"
1616
pydantic = ">=2.10.0"
1717
websockets = "^15.0.1"

common/src/binance_common/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,10 @@ def send_request(
335335
parsed = json.loads(response.text)
336336
is_list = isinstance(parsed, list)
337337
is_oneof = is_one_of_model(response_model)
338-
is_flat_list = is_list and not isinstance(parsed[0], list) if is_list else False
338+
is_flat_list = is_list and (
339+
len(parsed) == 0 or
340+
(not isinstance(parsed[0], list) if is_list else False)
341+
)
339342
if (is_list and not is_flat_list) or not response_model:
340343
data_function = lambda: parsed
341344
elif is_oneof or is_list:

common/tests/unit/test_utils.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,40 @@ def test_successful_request(
559559
proxies=None,
560560
)
561561

562+
@patch("binance_common.utils.encoded_string", side_effect=lambda x: x)
563+
@patch("binance_common.utils.cleanNoneValue", side_effect=lambda x: x)
564+
@patch("binance_common.utils.parse_rate_limit_headers", return_value=[])
565+
def test_successful_request_empty_array_response(
566+
self, mock_parse_rate_limits, mock_clean_none, mock_encoded_string
567+
):
568+
"""Test successful request (200 response)."""
569+
mock_response = Mock(status_code=200)
570+
mock_response.json.return_value = []
571+
mock_response.text = json.dumps([])
572+
573+
self.session.request.return_value = mock_response
574+
575+
response = send_request(
576+
self.session, self.configuration, self.method, self.path, {"param": "value"}
577+
)
578+
579+
self.assertEqual(response.data(), [])
580+
self.assertEqual(response.status, 200)
581+
self.assertEqual(response.headers, mock_response.headers)
582+
self.assertEqual(response.rate_limits, [])
583+
584+
headers = self.configuration.base_headers
585+
headers["Connection"] = "close"
586+
587+
self.session.request.assert_called_once_with(
588+
method=self.method,
589+
url=self.url,
590+
params={"param": "value"},
591+
headers=headers,
592+
timeout=5,
593+
proxies=None,
594+
)
595+
562596
@patch("binance_common.utils.encoded_string", side_effect=lambda x: x)
563597
@patch("binance_common.utils.cleanNoneValue", side_effect=lambda x: x)
564598
def test_client_errors(self, mock_clean_none, mock_encoded_string):

0 commit comments

Comments
 (0)