Skip to content

Commit 12cdeeb

Browse files
authored
Merge pull request #43 from coingecko/release-please--branches--main--changes--next
release: 1.14.1
2 parents 0c9128f + 7fd3382 commit 12cdeeb

8 files changed

Lines changed: 76 additions & 5 deletions

File tree

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.14.0"
2+
".": "1.14.1"
33
}

CHANGELOG.md

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

3+
## 1.14.1 (2026-04-11)
4+
5+
Full Changelog: [v1.14.0...v1.14.1](https://github.com/coingecko/coingecko-python/compare/v1.14.0...v1.14.1)
6+
7+
### Bug Fixes
8+
9+
* **client:** preserve hardcoded query params when merging with user params ([ffefe0c](https://github.com/coingecko/coingecko-python/commit/ffefe0c8418ab5f77790f3c21dbd78157879c629))
10+
* ensure file data are only sent as 1 parameter ([7b09afe](https://github.com/coingecko/coingecko-python/commit/7b09afe02609030c9da627e2f3475063652a254a))
11+
312
## 1.14.0 (2026-03-27)
413

514
Full Changelog: [v1.13.0...v1.14.0](https://github.com/coingecko/coingecko-python/compare/v1.13.0...v1.14.0)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "coingecko_sdk"
3-
version = "1.14.0"
3+
version = "1.14.1"
44
description = "The official Python library for the coingecko API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"

src/coingecko_sdk/_base_client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,10 @@ def _build_request(
540540
files = cast(HttpxRequestFiles, ForceMultipartDict())
541541

542542
prepared_url = self._prepare_url(options.url)
543+
# preserve hard-coded query params from the url
544+
if params and prepared_url.query:
545+
params = {**dict(prepared_url.params.items()), **params}
546+
prepared_url = prepared_url.copy_with(raw_path=prepared_url.raw_path.split(b"?", 1)[0])
543547
if "_" in prepared_url.host:
544548
# work around https://github.com/encode/httpx/discussions/2880
545549
kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")}

src/coingecko_sdk/_utils/_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,9 @@ def _extract_items(
8686
index += 1
8787
if is_dict(obj):
8888
try:
89-
# We are at the last entry in the path so we must remove the field
90-
if (len(path)) == index:
89+
# Remove the field if there are no more dict keys in the path,
90+
# only "<array>" traversal markers or end.
91+
if all(p == "<array>" for p in path[index:]):
9192
item = obj.pop(key)
9293
else:
9394
item = obj[key]

src/coingecko_sdk/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "coingecko_sdk"
4-
__version__ = "1.14.0" # x-release-please-version
4+
__version__ = "1.14.1" # x-release-please-version

tests/test_client.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,30 @@ def test_default_query_option(self) -> None:
447447

448448
client.close()
449449

450+
def test_hardcoded_query_params_in_url(self, client: Coingecko) -> None:
451+
request = client._build_request(FinalRequestOptions(method="get", url="/foo?beta=true"))
452+
url = httpx.URL(request.url)
453+
assert dict(url.params) == {"beta": "true"}
454+
455+
request = client._build_request(
456+
FinalRequestOptions(
457+
method="get",
458+
url="/foo?beta=true",
459+
params={"limit": "10", "page": "abc"},
460+
)
461+
)
462+
url = httpx.URL(request.url)
463+
assert dict(url.params) == {"beta": "true", "limit": "10", "page": "abc"}
464+
465+
request = client._build_request(
466+
FinalRequestOptions(
467+
method="get",
468+
url="/files/a%2Fb?beta=true",
469+
params={"limit": "10"},
470+
)
471+
)
472+
assert request.url.raw_path == b"/files/a%2Fb?beta=true&limit=10"
473+
450474
def test_request_extra_json(self, client: Coingecko) -> None:
451475
request = client._build_request(
452476
FinalRequestOptions(
@@ -1385,6 +1409,30 @@ async def test_default_query_option(self) -> None:
13851409

13861410
await client.close()
13871411

1412+
async def test_hardcoded_query_params_in_url(self, async_client: AsyncCoingecko) -> None:
1413+
request = async_client._build_request(FinalRequestOptions(method="get", url="/foo?beta=true"))
1414+
url = httpx.URL(request.url)
1415+
assert dict(url.params) == {"beta": "true"}
1416+
1417+
request = async_client._build_request(
1418+
FinalRequestOptions(
1419+
method="get",
1420+
url="/foo?beta=true",
1421+
params={"limit": "10", "page": "abc"},
1422+
)
1423+
)
1424+
url = httpx.URL(request.url)
1425+
assert dict(url.params) == {"beta": "true", "limit": "10", "page": "abc"}
1426+
1427+
request = async_client._build_request(
1428+
FinalRequestOptions(
1429+
method="get",
1430+
url="/files/a%2Fb?beta=true",
1431+
params={"limit": "10"},
1432+
)
1433+
)
1434+
assert request.url.raw_path == b"/files/a%2Fb?beta=true&limit=10"
1435+
13881436
def test_request_extra_json(self, client: Coingecko) -> None:
13891437
request = client._build_request(
13901438
FinalRequestOptions(

tests/test_extract_files.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ def test_multiple_files() -> None:
3535
assert query == {"documents": [{}, {}]}
3636

3737

38+
def test_top_level_file_array() -> None:
39+
query = {"files": [b"file one", b"file two"], "title": "hello"}
40+
assert extract_files(query, paths=[["files", "<array>"]]) == [
41+
("files[]", b"file one"),
42+
("files[]", b"file two"),
43+
]
44+
assert query == {"title": "hello"}
45+
46+
3847
@pytest.mark.parametrize(
3948
"query,paths,expected",
4049
[

0 commit comments

Comments
 (0)