Skip to content

Commit fbdfe29

Browse files
committed
resolve
2 parents b17896b + d3d5923 commit fbdfe29

File tree

7 files changed

+95
-11
lines changed

7 files changed

+95
-11
lines changed

CHANGELOG.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
<!-- git-cliff-unreleased-start -->
6+
## 1.12.3 - **not yet released**
7+
8+
### 🚀 Features
9+
10+
- Extend status parameter to an array of possible statuses ([#455](https://github.com/apify/apify-client-python/pull/455)) ([76f6769](https://github.com/apify/apify-client-python/commit/76f676973d067ce8af398d8e6ceea55595da5ecf)) by [@JanHranicky](https://github.com/JanHranicky)
11+
12+
13+
<!-- git-cliff-unreleased-end -->
14+
## [1.12.2](https://github.com/apify/apify-client-python/releases/tag/v1.12.2) (2025-08-08)
15+
16+
### 🐛 Bug Fixes
17+
18+
- Fix API error with stream ([#459](https://github.com/apify/apify-client-python/pull/459)) ([0c91ca5](https://github.com/apify/apify-client-python/commit/0c91ca516a01a6fca7bc8fa07f7bf9c15c75bf9d)) by [@Pijukatel](https://github.com/Pijukatel)
19+
20+
521
## [1.12.1](https://github.com/apify/apify-client-python/releases/tag/v1.12.1) (2025-07-30)
622

723
### 🐛 Bug Fixes
@@ -388,4 +404,4 @@ All notable changes to this project will be documented in this file.
388404

389405
## [0.0.1](https://github.com/apify/apify-client-python/releases/tag/v0.0.1) (2021-05-13)
390406

391-
- Initial release of the package.
407+
- Initial release of the package.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "apify_client"
7-
version = "1.12.1"
7+
version = "1.12.3"
88
description = "Apify API client for Python"
99
authors = [{ name = "Apify Technologies s.r.o.", email = "support@apify.com" }]
1010
license = { file = "LICENSE" }

src/apify_client/clients/resource_clients/run_collection.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def list(
2626
limit: int | None = None,
2727
offset: int | None = None,
2828
desc: bool | None = None,
29-
status: ActorJobStatus | None = None,
29+
status: ActorJobStatus | list[ActorJobStatus] | None = None,
3030
) -> ListPage[dict]:
3131
"""List all Actor runs.
3232
@@ -40,16 +40,21 @@ def list(
4040
limit: How many runs to retrieve.
4141
offset: What run to include as first when retrieving the list.
4242
desc: Whether to sort the runs in descending order based on their start date.
43-
status: Retrieve only runs with the provided status.
43+
status: Retrieve only runs with the provided statuses.
4444
4545
Returns:
4646
The retrieved Actor runs.
4747
"""
48+
if isinstance(status, list):
49+
status_param = [maybe_extract_enum_member_value(s) for s in status]
50+
else:
51+
status_param = maybe_extract_enum_member_value(status)
52+
4853
return self._list(
4954
limit=limit,
5055
offset=offset,
5156
desc=desc,
52-
status=maybe_extract_enum_member_value(status),
57+
status=status_param,
5358
)
5459

5560

@@ -67,7 +72,7 @@ async def list(
6772
limit: int | None = None,
6873
offset: int | None = None,
6974
desc: bool | None = None,
70-
status: ActorJobStatus | None = None,
75+
status: ActorJobStatus | list[ActorJobStatus] | None = None,
7176
) -> ListPage[dict]:
7277
"""List all Actor runs.
7378
@@ -81,14 +86,19 @@ async def list(
8186
limit: How many runs to retrieve.
8287
offset: What run to include as first when retrieving the list.
8388
desc: Whether to sort the runs in descending order based on their start date.
84-
status: Retrieve only runs with the provided status.
89+
status: Retrieve only runs with the provided statuses.
8590
8691
Returns:
8792
The retrieved Actor runs.
8893
"""
94+
if isinstance(status, list):
95+
status_param = [maybe_extract_enum_member_value(s) for s in status]
96+
else:
97+
status_param = maybe_extract_enum_member_value(status)
98+
8999
return await self._list(
90100
limit=limit,
91101
offset=offset,
92102
desc=desc,
93-
status=maybe_extract_enum_member_value(status),
103+
status=status_param,
94104
)
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
from __future__ import annotations
2+
3+
from typing import TYPE_CHECKING
4+
5+
import pytest
6+
7+
if TYPE_CHECKING:
8+
from apify_client import ApifyClient
9+
10+
from apify_shared.consts import ActorJobStatus
11+
12+
pytestmark = pytest.mark.integration
13+
14+
15+
class TestRunCollectionSync:
16+
APIFY_HELLO_WORLD_ACTOR = 'apify/hello-world'
17+
created_runs: list[dict]
18+
19+
def setup_runs(self, apify_client: ApifyClient) -> None:
20+
self.created_runs = []
21+
22+
successfull_run = apify_client.actor(self.APIFY_HELLO_WORLD_ACTOR).call()
23+
if successfull_run is not None:
24+
self.created_runs.append(successfull_run)
25+
26+
timed_out_run = apify_client.actor(self.APIFY_HELLO_WORLD_ACTOR).call(timeout_secs=1)
27+
if timed_out_run is not None:
28+
self.created_runs.append(timed_out_run)
29+
30+
def teadown_runs(self, apify_client: ApifyClient) -> None:
31+
for run in self.created_runs:
32+
run_id = run.get('id')
33+
if isinstance(run_id, str):
34+
apify_client.run(run_id).delete()
35+
36+
async def test_run_collection_list_multiple_statuses(self, apify_client: ApifyClient) -> None:
37+
self.setup_runs(apify_client)
38+
39+
run_collection = apify_client.actor(self.APIFY_HELLO_WORLD_ACTOR).runs()
40+
41+
multiple_status_runs = run_collection.list(status=[ActorJobStatus.SUCCEEDED, ActorJobStatus.TIMED_OUT])
42+
single_status_runs = run_collection.list(status=ActorJobStatus.SUCCEEDED)
43+
44+
assert multiple_status_runs is not None
45+
assert single_status_runs is not None
46+
47+
assert hasattr(multiple_status_runs, 'items')
48+
assert hasattr(single_status_runs, 'items')
49+
50+
assert all(
51+
run.get('status') in [ActorJobStatus.SUCCEEDED, ActorJobStatus.TIMED_OUT]
52+
for run in multiple_status_runs.items
53+
)
54+
assert all(run.get('status') == ActorJobStatus.SUCCEEDED for run in single_status_runs.items)
55+
56+
self.teadown_runs(apify_client)

tests/unit/test_client_timeouts.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ def mock_request(*_args: Any, **kwargs: Any) -> Response:
150150
]
151151

152152

153+
# This test will probably need to be reworked or skipped when switching to `impit`.
154+
# Without the mock library, it's difficult to reproduce, maybe with monkeypatch?
153155
@pytest.mark.parametrize(
154156
('client_type', 'method', 'expected_timeout', 'kwargs'),
155157
_timeout_params,
@@ -171,6 +173,8 @@ def test_specific_timeouts_for_specific_endpoints_sync(
171173
assert patch_request[0] == expected_timeout
172174

173175

176+
# This test will probably need to be reworked or skipped when switching to `impit`.
177+
# Without the mock library, it's difficult to reproduce, maybe with monkeypatch?
174178
@pytest.mark.parametrize(
175179
('client_type', 'method', 'expected_timeout', 'kwargs'),
176180
_timeout_params,

tests/unit/test_logging.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,7 @@ def test_redirected_logs_sync(
242242

243243
with caplog.at_level(logging.DEBUG, logger=logger_name), streamed_log:
244244
# Do stuff while the log from the other Actor is being redirected to the logs.
245-
print(1)
246245
time.sleep(1)
247-
print(2)
248246

249247
# Ensure logs are propagated
250248
assert {(record.message, record.levelno) for record in caplog.records} == set(

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)