From d9be991d91bed955eef215b0e5cd7256e803a66c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 30 Jul 2025 17:04:15 +0000 Subject: [PATCH 1/3] feat(client): support file upload requests --- src/finch/_base_client.py | 5 ++++- src/finch/_files.py | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/finch/_base_client.py b/src/finch/_base_client.py index a904662b..d3105a67 100644 --- a/src/finch/_base_client.py +++ b/src/finch/_base_client.py @@ -533,7 +533,10 @@ def _build_request( is_body_allowed = options.method.lower() != "get" if is_body_allowed: - kwargs["json"] = json_data if is_given(json_data) else None + if isinstance(json_data, bytes): + kwargs["content"] = json_data + else: + kwargs["json"] = json_data if is_given(json_data) else None kwargs["files"] = files else: headers.pop("Content-Type", None) diff --git a/src/finch/_files.py b/src/finch/_files.py index 715cc207..cc14c14f 100644 --- a/src/finch/_files.py +++ b/src/finch/_files.py @@ -69,12 +69,12 @@ def _transform_file(file: FileTypes) -> HttpxFileTypes: return file if is_tuple_t(file): - return (file[0], _read_file_content(file[1]), *file[2:]) + return (file[0], read_file_content(file[1]), *file[2:]) raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple") -def _read_file_content(file: FileContent) -> HttpxFileContent: +def read_file_content(file: FileContent) -> HttpxFileContent: if isinstance(file, os.PathLike): return pathlib.Path(file).read_bytes() return file @@ -111,12 +111,12 @@ async def _async_transform_file(file: FileTypes) -> HttpxFileTypes: return file if is_tuple_t(file): - return (file[0], await _async_read_file_content(file[1]), *file[2:]) + return (file[0], await async_read_file_content(file[1]), *file[2:]) raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple") -async def _async_read_file_content(file: FileContent) -> HttpxFileContent: +async def async_read_file_content(file: FileContent) -> HttpxFileContent: if isinstance(file, os.PathLike): return await anyio.Path(file).read_bytes() From 7ae6fe67280401bc237ec7efdf3ce89e99a00484 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 5 Aug 2025 11:25:19 +0000 Subject: [PATCH 2/3] chore(internal): fix ruff target version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index bc03d901..4ab76b54 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -159,7 +159,7 @@ reportPrivateUsage = false [tool.ruff] line-length = 120 output-format = "grouped" -target-version = "py37" +target-version = "py38" [tool.ruff.format] docstring-code-format = true From 2a2f897ed8805b42e972e4f917540a4043780fbb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 5 Aug 2025 11:25:41 +0000 Subject: [PATCH 3/3] release: 1.32.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ pyproject.toml | 2 +- src/finch/_version.py | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 81d2de2d..592b0e15 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.31.0" + ".": "1.32.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 758775fa..4b95a325 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 1.32.0 (2025-08-05) + +Full Changelog: [v1.31.0...v1.32.0](https://github.com/Finch-API/finch-api-python/compare/v1.31.0...v1.32.0) + +### Features + +* **client:** support file upload requests ([d9be991](https://github.com/Finch-API/finch-api-python/commit/d9be991d91bed955eef215b0e5cd7256e803a66c)) + + +### Chores + +* **internal:** fix ruff target version ([7ae6fe6](https://github.com/Finch-API/finch-api-python/commit/7ae6fe67280401bc237ec7efdf3ce89e99a00484)) + ## 1.31.0 (2025-07-24) Full Changelog: [v1.30.3...v1.31.0](https://github.com/Finch-API/finch-api-python/compare/v1.30.3...v1.31.0) diff --git a/pyproject.toml b/pyproject.toml index 4ab76b54..b0239d18 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "finch-api" -version = "1.31.0" +version = "1.32.0" description = "The official Python library for the Finch API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/finch/_version.py b/src/finch/_version.py index 2c0bc814..302affe5 100644 --- a/src/finch/_version.py +++ b/src/finch/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "finch" -__version__ = "1.31.0" # x-release-please-version +__version__ = "1.32.0" # x-release-please-version