From 44693a588b2d750d2461b1104a6c251fbc30f33f Mon Sep 17 00:00:00 2001 From: koval Date: Fri, 20 Feb 2026 16:27:34 +0300 Subject: [PATCH 1/3] Add filename to File.upload --- huntflow_api_client/entities/file.py | 8 +++++++- pyproject.toml | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/huntflow_api_client/entities/file.py b/huntflow_api_client/entities/file.py index 482e6dd..21225ff 100644 --- a/huntflow_api_client/entities/file.py +++ b/huntflow_api_client/entities/file.py @@ -12,6 +12,7 @@ async def upload( headers: UploadFileHeaders, file: Union[bytes, BinaryIO], preset: Optional[str] = None, + filename: Optional[str] = None, ) -> UploadResponse: """ API method reference https://api.huntflow.ai/v2/docs#post-/accounts/-account_id-/upload @@ -20,16 +21,21 @@ async def upload( :param file: File :param preset: Preset :param headers: Headers + :param filename: Filename :return: Additional data """ data = {} if preset: data["preset"] = preset + if filename: + files = {"file": (filename, file)} + else: + files = {"file": file} response = await self._api.request( "POST", f"/accounts/{account_id}/upload", - files={"file": file}, + files=files, data=data, headers=headers.jsonable_dict(exclude_none=True, by_alias=True), ) diff --git a/pyproject.toml b/pyproject.toml index e018b42..cb7f5ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "huntflow-api-client" -version = "2.10.0" +version = "2.11.0" description = "Huntflow API Client for Python" authors = [ {name = "Developers huntflow", email = "developer@huntflow.ru"}, From cc703400287a3852bb2ebc58c25b737a6c8bbcfc Mon Sep 17 00:00:00 2001 From: koval Date: Fri, 20 Feb 2026 16:31:14 +0300 Subject: [PATCH 2/3] codestyle --- huntflow_api_client/entities/file.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/huntflow_api_client/entities/file.py b/huntflow_api_client/entities/file.py index 21225ff..8ba9d6c 100644 --- a/huntflow_api_client/entities/file.py +++ b/huntflow_api_client/entities/file.py @@ -1,4 +1,4 @@ -from typing import BinaryIO, Optional, Union +from typing import BinaryIO, Optional, Union, Dict, Tuple from huntflow_api_client.entities.base import BaseEntity from huntflow_api_client.models.request.file import UploadFileHeaders @@ -28,10 +28,13 @@ async def upload( data = {} if preset: data["preset"] = preset + + files: Dict[str, Union[Union[bytes, BinaryIO], Tuple[str, Union[bytes, BinaryIO]]]] = {} if filename: - files = {"file": (filename, file)} + files["file"] = (filename, file) else: - files = {"file": file} + files["file"] = file + response = await self._api.request( "POST", f"/accounts/{account_id}/upload", From e12eedd1e44d8734e06de02758556987c1878d27 Mon Sep 17 00:00:00 2001 From: koval Date: Fri, 20 Feb 2026 16:32:49 +0300 Subject: [PATCH 3/3] sort imports --- huntflow_api_client/entities/file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/huntflow_api_client/entities/file.py b/huntflow_api_client/entities/file.py index 8ba9d6c..479739c 100644 --- a/huntflow_api_client/entities/file.py +++ b/huntflow_api_client/entities/file.py @@ -1,4 +1,4 @@ -from typing import BinaryIO, Optional, Union, Dict, Tuple +from typing import BinaryIO, Dict, Optional, Tuple, Union from huntflow_api_client.entities.base import BaseEntity from huntflow_api_client.models.request.file import UploadFileHeaders