From 67ee2ebc3cabbb89442c07ba0f5d1b4d917efab2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 4 Apr 2026 15:36:08 +0000 Subject: [PATCH 1/5] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index f17b8ce..188067d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 27 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api%2Fmoderation-api-a4934bf1e7f1348c021b48224f7a7110a6e41838253dda4fbcc720dd2d2ed6b7.yml openapi_spec_hash: 537542216811907b1d4ebf23a54dc669 -config_hash: 6b825a08e19dfb747c5dc1766502b789 +config_hash: 0a024bca1710e3a3194925edfedc513c From ed3bc74115ec809ba528a2f7af4cc2d83b74cc97 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 4 Apr 2026 15:36:22 +0000 Subject: [PATCH 2/5] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 188067d..c602470 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 27 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api%2Fmoderation-api-a4934bf1e7f1348c021b48224f7a7110a6e41838253dda4fbcc720dd2d2ed6b7.yml openapi_spec_hash: 537542216811907b1d4ebf23a54dc669 -config_hash: 0a024bca1710e3a3194925edfedc513c +config_hash: 13d10207114afb65f7ac4e21f4c0e358 From ad734f31bab55dee30e09bd10946120613085489 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 4 Apr 2026 15:42:42 +0000 Subject: [PATCH 3/5] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index c602470..188067d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 27 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api%2Fmoderation-api-a4934bf1e7f1348c021b48224f7a7110a6e41838253dda4fbcc720dd2d2ed6b7.yml openapi_spec_hash: 537542216811907b1d4ebf23a54dc669 -config_hash: 13d10207114afb65f7ac4e21f4c0e358 +config_hash: 0a024bca1710e3a3194925edfedc513c From b7b90113856681532a7c9122705e8f5f9ec80d93 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 8 Apr 2026 05:09:43 +0000 Subject: [PATCH 4/5] fix(client): preserve hardcoded query params when merging with user params --- src/moderation_api/_base_client.py | 4 +++ tests/test_client.py | 48 ++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/src/moderation_api/_base_client.py b/src/moderation_api/_base_client.py index cb4fb7c..5e263d4 100644 --- a/src/moderation_api/_base_client.py +++ b/src/moderation_api/_base_client.py @@ -540,6 +540,10 @@ def _build_request( files = cast(HttpxRequestFiles, ForceMultipartDict()) prepared_url = self._prepare_url(options.url) + # preserve hard-coded query params from the url + if params and prepared_url.query: + params = {**dict(prepared_url.params.items()), **params} + prepared_url = prepared_url.copy_with(raw_path=prepared_url.raw_path.split(b"?", 1)[0]) if "_" in prepared_url.host: # work around https://github.com/encode/httpx/discussions/2880 kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")} diff --git a/tests/test_client.py b/tests/test_client.py index d485dae..3e1b849 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -432,6 +432,30 @@ def test_default_query_option(self) -> None: client.close() + def test_hardcoded_query_params_in_url(self, client: ModerationAPI) -> None: + request = client._build_request(FinalRequestOptions(method="get", url="/foo?beta=true")) + url = httpx.URL(request.url) + assert dict(url.params) == {"beta": "true"} + + request = client._build_request( + FinalRequestOptions( + method="get", + url="/foo?beta=true", + params={"limit": "10", "page": "abc"}, + ) + ) + url = httpx.URL(request.url) + assert dict(url.params) == {"beta": "true", "limit": "10", "page": "abc"} + + request = client._build_request( + FinalRequestOptions( + method="get", + url="/files/a%2Fb?beta=true", + params={"limit": "10"}, + ) + ) + assert request.url.raw_path == b"/files/a%2Fb?beta=true&limit=10" + def test_request_extra_json(self, client: ModerationAPI) -> None: request = client._build_request( FinalRequestOptions( @@ -1365,6 +1389,30 @@ async def test_default_query_option(self) -> None: await client.close() + async def test_hardcoded_query_params_in_url(self, async_client: AsyncModerationAPI) -> None: + request = async_client._build_request(FinalRequestOptions(method="get", url="/foo?beta=true")) + url = httpx.URL(request.url) + assert dict(url.params) == {"beta": "true"} + + request = async_client._build_request( + FinalRequestOptions( + method="get", + url="/foo?beta=true", + params={"limit": "10", "page": "abc"}, + ) + ) + url = httpx.URL(request.url) + assert dict(url.params) == {"beta": "true", "limit": "10", "page": "abc"} + + request = async_client._build_request( + FinalRequestOptions( + method="get", + url="/files/a%2Fb?beta=true", + params={"limit": "10"}, + ) + ) + assert request.url.raw_path == b"/files/a%2Fb?beta=true&limit=10" + def test_request_extra_json(self, client: ModerationAPI) -> None: request = client._build_request( FinalRequestOptions( From 887f95687469dcbe67983deb4be18f198023be13 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 8 Apr 2026 05:09:58 +0000 Subject: [PATCH 5/5] release: 1.14.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/moderation_api/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e72f113..a780111 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.14.0" + ".": "1.14.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index f02740c..a608137 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.14.1 (2026-04-08) + +Full Changelog: [v1.14.0...v1.14.1](https://github.com/moderation-api/sdk-python/compare/v1.14.0...v1.14.1) + +### Bug Fixes + +* **client:** preserve hardcoded query params when merging with user params ([b7b9011](https://github.com/moderation-api/sdk-python/commit/b7b90113856681532a7c9122705e8f5f9ec80d93)) + ## 1.14.0 (2026-03-31) Full Changelog: [v1.13.0...v1.14.0](https://github.com/moderation-api/sdk-python/compare/v1.13.0...v1.14.0) diff --git a/pyproject.toml b/pyproject.toml index f1e3222..ea96b94 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "moderation_api" -version = "1.14.0" +version = "1.14.1" description = "The official Python library for the moderation-api API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/moderation_api/_version.py b/src/moderation_api/_version.py index 898245b..af94acf 100644 --- a/src/moderation_api/_version.py +++ b/src/moderation_api/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "moderation_api" -__version__ = "1.14.0" # x-release-please-version +__version__ = "1.14.1" # x-release-please-version