diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a70954af..537b8e0b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.43.0" + ".": "4.43.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 75dc0980..2d82b418 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.43.1 (2025-11-27) + +Full Changelog: [v4.43.0...v4.43.1](https://github.com/orbcorp/orb-python/compare/v4.43.0...v4.43.1) + +### Bug Fixes + +* ensure streams are always closed ([3c4918f](https://github.com/orbcorp/orb-python/commit/3c4918f9ee4f45e6a0fd7ea63436f663710a23b1)) + ## 4.43.0 (2025-11-25) Full Changelog: [v4.42.0...v4.43.0](https://github.com/orbcorp/orb-python/compare/v4.42.0...v4.43.0) diff --git a/pyproject.toml b/pyproject.toml index 03c574e5..49f353e8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "orb-billing" -version = "4.43.0" +version = "4.43.1" description = "The official Python library for the orb API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/orb/_streaming.py b/src/orb/_streaming.py index 4efca455..943d03ab 100644 --- a/src/orb/_streaming.py +++ b/src/orb/_streaming.py @@ -54,11 +54,12 @@ def __stream__(self) -> Iterator[_T]: process_data = self._client._process_response_data iterator = self._iter_events() - for sse in iterator: - yield process_data(data=sse.json(), cast_to=cast_to, response=response) - - # As we might not fully consume the response stream, we need to close it explicitly - response.close() + try: + for sse in iterator: + yield process_data(data=sse.json(), cast_to=cast_to, response=response) + finally: + # Ensure the response is closed even if the consumer doesn't read all data + response.close() def __enter__(self) -> Self: return self @@ -117,11 +118,12 @@ async def __stream__(self) -> AsyncIterator[_T]: process_data = self._client._process_response_data iterator = self._iter_events() - async for sse in iterator: - yield process_data(data=sse.json(), cast_to=cast_to, response=response) - - # As we might not fully consume the response stream, we need to close it explicitly - await response.aclose() + try: + async for sse in iterator: + yield process_data(data=sse.json(), cast_to=cast_to, response=response) + finally: + # Ensure the response is closed even if the consumer doesn't read all data + await response.aclose() async def __aenter__(self) -> Self: return self diff --git a/src/orb/_version.py b/src/orb/_version.py index 7dc7e9de..99c0b943 100644 --- a/src/orb/_version.py +++ b/src/orb/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "orb" -__version__ = "4.43.0" # x-release-please-version +__version__ = "4.43.1" # x-release-please-version