diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e0dc500..89c23ba 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.1.0" + ".": "3.1.1" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index ded0391..9e88ff9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 18 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openregister%2Fopenregister-cdea05542fb87dc7f00544bdd53fd82469ad985a48aa0d96fdd74011464e3a5d.yml openapi_spec_hash: e49334a0e9b0d800974f7453910ab5ee -config_hash: 6b8c0142ef1c8e22e9ca6b5b834e2a04 +config_hash: 37583af6a46faf905309043dc42cad52 diff --git a/CHANGELOG.md b/CHANGELOG.md index 872e43e..f2abf20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 3.1.1 (2026-04-08) + +Full Changelog: [v3.1.0...v3.1.1](https://github.com/oregister/openregister-python/compare/v3.1.0...v3.1.1) + +### Bug Fixes + +* **client:** preserve hardcoded query params when merging with user params ([fa40ea6](https://github.com/oregister/openregister-python/commit/fa40ea6bd6af4dfe19c55e67a2dbb0c51098bc6e)) + + +### Chores + +* **client:** increase timeouts ([61f64e6](https://github.com/oregister/openregister-python/commit/61f64e689752e125cf887e8c5c0bd11ccc9c3843)) + ## 3.1.0 (2026-03-27) Full Changelog: [v3.0.3...v3.1.0](https://github.com/oregister/openregister-python/compare/v3.0.3...v3.1.0) diff --git a/README.md b/README.md index 17fc30b..2427f60 100644 --- a/README.md +++ b/README.md @@ -207,7 +207,7 @@ client.with_options(max_retries=5).company.get_details_v1( ### Timeouts -By default requests time out after 1 minute. You can configure this with a `timeout` option, +By default requests time out after 3 minutes. You can configure this with a `timeout` option, which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object: ```python @@ -215,7 +215,7 @@ from openregister import Openregister # Configure the default for all requests: client = Openregister( - # 20 seconds (default is 1 minute) + # 20 seconds (default is 3 minutes) timeout=20.0, ) diff --git a/pyproject.toml b/pyproject.toml index d3696b0..c145eee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openregister-sdk" -version = "3.1.0" +version = "3.1.1" description = "The official Python library for the openregister API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/openregister/_base_client.py b/src/openregister/_base_client.py index 192bb43..43f47b2 100644 --- a/src/openregister/_base_client.py +++ b/src/openregister/_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/src/openregister/_constants.py b/src/openregister/_constants.py index 6ddf2c7..eeeb094 100644 --- a/src/openregister/_constants.py +++ b/src/openregister/_constants.py @@ -5,8 +5,8 @@ RAW_RESPONSE_HEADER = "X-Stainless-Raw-Response" OVERRIDE_CAST_TO_HEADER = "____stainless_override_cast_to" -# default timeout is 1 minute -DEFAULT_TIMEOUT = httpx.Timeout(timeout=60, connect=5.0) +# default timeout is 3 minutes +DEFAULT_TIMEOUT = httpx.Timeout(timeout=180, connect=5.0) DEFAULT_MAX_RETRIES = 2 DEFAULT_CONNECTION_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20) diff --git a/src/openregister/_version.py b/src/openregister/_version.py index b7798f9..0eeb5c7 100644 --- a/src/openregister/_version.py +++ b/src/openregister/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "openregister" -__version__ = "3.1.0" # x-release-please-version +__version__ = "3.1.1" # x-release-please-version diff --git a/tests/test_client.py b/tests/test_client.py index 2219c1b..222a1f0 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -429,6 +429,30 @@ def test_default_query_option(self) -> None: client.close() + def test_hardcoded_query_params_in_url(self, client: Openregister) -> 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: Openregister) -> None: request = client._build_request( FinalRequestOptions( @@ -1336,6 +1360,30 @@ async def test_default_query_option(self) -> None: await client.close() + async def test_hardcoded_query_params_in_url(self, async_client: AsyncOpenregister) -> 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: Openregister) -> None: request = client._build_request( FinalRequestOptions(