From 8d86838f4812784ff76c14d07799699129db4ecb Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Wed, 25 Feb 2026 15:59:59 +0100 Subject: [PATCH 1/3] fix: Accept None for UserClient resource_id to match caller signature Co-Authored-By: Claude Opus 4.6 --- .../_resource_clients/actor_collection.py | 26 ++++++++++---- .../_resource_clients/actor_env_var.py | 30 ++++++++++++---- .../actor_env_var_collection.py | 26 ++++++++++---- .../actor_version_collection.py | 26 ++++++++++---- .../_resource_clients/build_collection.py | 26 ++++++++++---- src/apify_client/_resource_clients/dataset.py | 30 ++++++++++++---- .../_resource_clients/dataset_collection.py | 26 ++++++++++---- .../_resource_clients/key_value_store.py | 30 ++++++++++++---- .../key_value_store_collection.py | 26 ++++++++++---- src/apify_client/_resource_clients/log.py | 30 ++++++++++++---- .../_resource_clients/request_queue.py | 22 ++++++++---- .../request_queue_collection.py | 26 ++++++++++---- .../_resource_clients/run_collection.py | 26 ++++++++++---- .../_resource_clients/schedule.py | 30 ++++++++++++---- .../_resource_clients/schedule_collection.py | 26 ++++++++++---- .../_resource_clients/store_collection.py | 26 ++++++++++---- .../_resource_clients/task_collection.py | 26 ++++++++++---- src/apify_client/_resource_clients/user.py | 36 ++++++++++++------- src/apify_client/_resource_clients/webhook.py | 30 ++++++++++++---- .../_resource_clients/webhook_collection.py | 26 ++++++++++---- .../_resource_clients/webhook_dispatch.py | 30 ++++++++++++---- .../webhook_dispatch_collection.py | 26 ++++++++++---- 22 files changed, 468 insertions(+), 138 deletions(-) diff --git a/src/apify_client/_resource_clients/actor_collection.py b/src/apify_client/_resource_clients/actor_collection.py index 255d9f9c..c25f2acb 100644 --- a/src/apify_client/_resource_clients/actor_collection.py +++ b/src/apify_client/_resource_clients/actor_collection.py @@ -20,9 +20,16 @@ class ActorCollectionClient(ResourceClient): method on the `ApifyClient` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'acts') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'acts', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) def list( self, @@ -152,9 +159,16 @@ class ActorCollectionClientAsync(ResourceClientAsync): method on the `ApifyClientAsync` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'acts') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'acts', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) async def list( self, diff --git a/src/apify_client/_resource_clients/actor_env_var.py b/src/apify_client/_resource_clients/actor_env_var.py index ea5acce9..0a18b2c1 100644 --- a/src/apify_client/_resource_clients/actor_env_var.py +++ b/src/apify_client/_resource_clients/actor_env_var.py @@ -30,9 +30,18 @@ class ActorEnvVarClient(ResourceClient): via an appropriate method on the `ActorVersionClient` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'env-vars') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_id: str, + resource_path: str = 'env-vars', + **kwargs: Any, + ) -> None: + super().__init__( + resource_id=resource_id, + resource_path=resource_path, + **kwargs, + ) def get(self) -> EnvVar | None: """Return information about the Actor environment variable. @@ -91,9 +100,18 @@ class ActorEnvVarClientAsync(ResourceClientAsync): via an appropriate method on the `ActorVersionClientAsync` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'env-vars') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_id: str, + resource_path: str = 'env-vars', + **kwargs: Any, + ) -> None: + super().__init__( + resource_id=resource_id, + resource_path=resource_path, + **kwargs, + ) async def get(self) -> EnvVar | None: """Return information about the Actor environment variable. diff --git a/src/apify_client/_resource_clients/actor_env_var_collection.py b/src/apify_client/_resource_clients/actor_env_var_collection.py index 4a82fb6a..57e3206a 100644 --- a/src/apify_client/_resource_clients/actor_env_var_collection.py +++ b/src/apify_client/_resource_clients/actor_env_var_collection.py @@ -17,9 +17,16 @@ class ActorEnvVarCollectionClient(ResourceClient): appropriate method on the `ActorVersionClient` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'env-vars') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'env-vars', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) def list(self) -> ListOfEnvVars: """List the available Actor environment variables. @@ -69,9 +76,16 @@ class ActorEnvVarCollectionClientAsync(ResourceClientAsync): appropriate method on the `ActorVersionClientAsync` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'env-vars') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'env-vars', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) async def list(self) -> ListOfEnvVars: """List the available Actor environment variables. diff --git a/src/apify_client/_resource_clients/actor_version_collection.py b/src/apify_client/_resource_clients/actor_version_collection.py index bde7517b..66395b4a 100644 --- a/src/apify_client/_resource_clients/actor_version_collection.py +++ b/src/apify_client/_resource_clients/actor_version_collection.py @@ -23,9 +23,16 @@ class ActorVersionCollectionClient(ResourceClient): on the `ActorClient` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'versions') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'versions', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) def list(self) -> ListOfVersions: """List the available Actor versions. @@ -99,9 +106,16 @@ class ActorVersionCollectionClientAsync(ResourceClientAsync): on the `ActorClientAsync` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'versions') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'versions', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) async def list(self) -> ListOfVersions: """List the available Actor versions. diff --git a/src/apify_client/_resource_clients/build_collection.py b/src/apify_client/_resource_clients/build_collection.py index 1a395a7f..a8457cac 100644 --- a/src/apify_client/_resource_clients/build_collection.py +++ b/src/apify_client/_resource_clients/build_collection.py @@ -15,9 +15,16 @@ class BuildCollectionClient(ResourceClient): `ApifyClient` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'actor-builds') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'actor-builds', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) def list( self, @@ -54,9 +61,16 @@ class BuildCollectionClientAsync(ResourceClientAsync): `ApifyClientAsync` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'actor-builds') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'actor-builds', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) async def list( self, diff --git a/src/apify_client/_resource_clients/dataset.py b/src/apify_client/_resource_clients/dataset.py index 2720a6cc..707dd2e6 100644 --- a/src/apify_client/_resource_clients/dataset.py +++ b/src/apify_client/_resource_clients/dataset.py @@ -66,9 +66,18 @@ class DatasetClient(ResourceClient): via an appropriate method on the `ApifyClient` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'datasets') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_id: str, + resource_path: str = 'datasets', + **kwargs: Any, + ) -> None: + super().__init__( + resource_id=resource_id, + resource_path=resource_path, + **kwargs, + ) def get(self) -> Dataset | None: """Retrieve the dataset. @@ -687,9 +696,18 @@ class DatasetClientAsync(ResourceClientAsync): via an appropriate method on the `ApifyClientAsync` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'datasets') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_id: str, + resource_path: str = 'datasets', + **kwargs: Any, + ) -> None: + super().__init__( + resource_id=resource_id, + resource_path=resource_path, + **kwargs, + ) async def get(self) -> Dataset | None: """Retrieve the dataset. diff --git a/src/apify_client/_resource_clients/dataset_collection.py b/src/apify_client/_resource_clients/dataset_collection.py index 2322fd67..9d7966c4 100644 --- a/src/apify_client/_resource_clients/dataset_collection.py +++ b/src/apify_client/_resource_clients/dataset_collection.py @@ -16,9 +16,16 @@ class DatasetCollectionClient(ResourceClient): appropriate method on the `ApifyClient` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'datasets') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'datasets', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) def list( self, @@ -68,9 +75,16 @@ class DatasetCollectionClientAsync(ResourceClientAsync): appropriate method on the `ApifyClientAsync` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'datasets') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'datasets', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) async def list( self, diff --git a/src/apify_client/_resource_clients/key_value_store.py b/src/apify_client/_resource_clients/key_value_store.py index 03119c5f..65acf685 100644 --- a/src/apify_client/_resource_clients/key_value_store.py +++ b/src/apify_client/_resource_clients/key_value_store.py @@ -77,9 +77,18 @@ class KeyValueStoreClient(ResourceClient): instance via an appropriate method on the `ApifyClient` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'key-value-stores') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_id: str, + resource_path: str = 'key-value-stores', + **kwargs: Any, + ) -> None: + super().__init__( + resource_id=resource_id, + resource_path=resource_path, + **kwargs, + ) def get(self) -> KeyValueStore | None: """Retrieve the key-value store. @@ -461,9 +470,18 @@ class KeyValueStoreClientAsync(ResourceClientAsync): instance via an appropriate method on the `ApifyClientAsync` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'key-value-stores') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_id: str, + resource_path: str = 'key-value-stores', + **kwargs: Any, + ) -> None: + super().__init__( + resource_id=resource_id, + resource_path=resource_path, + **kwargs, + ) async def get(self) -> KeyValueStore | None: """Retrieve the key-value store. diff --git a/src/apify_client/_resource_clients/key_value_store_collection.py b/src/apify_client/_resource_clients/key_value_store_collection.py index f693952d..777c138f 100644 --- a/src/apify_client/_resource_clients/key_value_store_collection.py +++ b/src/apify_client/_resource_clients/key_value_store_collection.py @@ -21,9 +21,16 @@ class KeyValueStoreCollectionClient(ResourceClient): via an appropriate method on the `ApifyClient` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'key-value-stores') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'key-value-stores', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) def list( self, @@ -78,9 +85,16 @@ class KeyValueStoreCollectionClientAsync(ResourceClientAsync): via an appropriate method on the `ApifyClientAsync` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'key-value-stores') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'key-value-stores', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) async def list( self, diff --git a/src/apify_client/_resource_clients/log.py b/src/apify_client/_resource_clients/log.py index 07493ab9..7c1076cb 100644 --- a/src/apify_client/_resource_clients/log.py +++ b/src/apify_client/_resource_clients/log.py @@ -22,9 +22,18 @@ class LogClient(ResourceClient): `ApifyClient` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'logs') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_id: str, + resource_path: str = 'logs', + **kwargs: Any, + ) -> None: + super().__init__( + resource_id=resource_id, + resource_path=resource_path, + **kwargs, + ) def get(self, *, raw: bool = False) -> str | None: """Retrieve the log as text. @@ -114,9 +123,18 @@ class LogClientAsync(ResourceClientAsync): `ApifyClientAsync` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'logs') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_id: str, + resource_path: str = 'logs', + **kwargs: Any, + ) -> None: + super().__init__( + resource_id=resource_id, + resource_path=resource_path, + **kwargs, + ) async def get(self, *, raw: bool = False) -> str | None: """Retrieve the log as text. diff --git a/src/apify_client/_resource_clients/request_queue.py b/src/apify_client/_resource_clients/request_queue.py index 408a3d73..7c22e502 100644 --- a/src/apify_client/_resource_clients/request_queue.py +++ b/src/apify_client/_resource_clients/request_queue.py @@ -62,7 +62,9 @@ class RequestQueueClient(ResourceClient): def __init__( # noqa: D417 self, - *args: Any, + *, + resource_id: str, + resource_path: str = 'request-queues', client_key: str | None = None, **kwargs: Any, ) -> None: @@ -71,8 +73,11 @@ def __init__( # noqa: D417 Args: client_key: A unique identifier of the client accessing the request queue. """ - resource_path = kwargs.pop('resource_path', 'request-queues') - super().__init__(*args, resource_path=resource_path, **kwargs) + super().__init__( + resource_id=resource_id, + resource_path=resource_path, + **kwargs, + ) self.client_key = client_key def get(self) -> RequestQueue | None: @@ -472,7 +477,9 @@ class RequestQueueClientAsync(ResourceClientAsync): def __init__( # noqa: D417 self, - *args: Any, + *, + resource_id: str, + resource_path: str = 'request-queues', client_key: str | None = None, **kwargs: Any, ) -> None: @@ -481,8 +488,11 @@ def __init__( # noqa: D417 Args: client_key: A unique identifier of the client accessing the request queue. """ - resource_path = kwargs.pop('resource_path', 'request-queues') - super().__init__(*args, resource_path=resource_path, **kwargs) + super().__init__( + resource_id=resource_id, + resource_path=resource_path, + **kwargs, + ) self.client_key = client_key async def get(self) -> RequestQueue | None: diff --git a/src/apify_client/_resource_clients/request_queue_collection.py b/src/apify_client/_resource_clients/request_queue_collection.py index 04ae9afd..11b0c0e2 100644 --- a/src/apify_client/_resource_clients/request_queue_collection.py +++ b/src/apify_client/_resource_clients/request_queue_collection.py @@ -20,9 +20,16 @@ class RequestQueueCollectionClient(ResourceClient): via an appropriate method on the `ApifyClient` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'request-queues') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'request-queues', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) def list( self, @@ -71,9 +78,16 @@ class RequestQueueCollectionClientAsync(ResourceClientAsync): via an appropriate method on the `ApifyClientAsync` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'request-queues') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'request-queues', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) async def list( self, diff --git a/src/apify_client/_resource_clients/run_collection.py b/src/apify_client/_resource_clients/run_collection.py index 2cf32801..3bc1ca82 100644 --- a/src/apify_client/_resource_clients/run_collection.py +++ b/src/apify_client/_resource_clients/run_collection.py @@ -21,9 +21,16 @@ class RunCollectionClient(ResourceClient): `ApifyClient` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'actor-runs') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'actor-runs', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) def list( self, @@ -75,9 +82,16 @@ class RunCollectionClientAsync(ResourceClientAsync): `ApifyClientAsync` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'actor-runs') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'actor-runs', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) async def list( self, diff --git a/src/apify_client/_resource_clients/schedule.py b/src/apify_client/_resource_clients/schedule.py index 63bd4ebd..dc94bd85 100644 --- a/src/apify_client/_resource_clients/schedule.py +++ b/src/apify_client/_resource_clients/schedule.py @@ -18,9 +18,18 @@ class ScheduleClient(ResourceClient): appropriate method on the `ApifyClient` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'schedules') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_id: str, + resource_path: str = 'schedules', + **kwargs: Any, + ) -> None: + super().__init__( + resource_id=resource_id, + resource_path=resource_path, + **kwargs, + ) def get(self) -> Schedule | None: """Return information about the schedule. @@ -118,9 +127,18 @@ class ScheduleClientAsync(ResourceClientAsync): appropriate method on the `ApifyClientAsync` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'schedules') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_id: str, + resource_path: str = 'schedules', + **kwargs: Any, + ) -> None: + super().__init__( + resource_id=resource_id, + resource_path=resource_path, + **kwargs, + ) async def get(self) -> Schedule | None: """Return information about the schedule. diff --git a/src/apify_client/_resource_clients/schedule_collection.py b/src/apify_client/_resource_clients/schedule_collection.py index a335b213..2dd9db47 100644 --- a/src/apify_client/_resource_clients/schedule_collection.py +++ b/src/apify_client/_resource_clients/schedule_collection.py @@ -17,9 +17,16 @@ class ScheduleCollectionClient(ResourceClient): appropriate method on the `ApifyClient` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'schedules') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'schedules', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) def list( self, @@ -100,9 +107,16 @@ class ScheduleCollectionClientAsync(ResourceClientAsync): appropriate method on the `ApifyClientAsync` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'schedules') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'schedules', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) async def list( self, diff --git a/src/apify_client/_resource_clients/store_collection.py b/src/apify_client/_resource_clients/store_collection.py index 002dacf3..16d63cb0 100644 --- a/src/apify_client/_resource_clients/store_collection.py +++ b/src/apify_client/_resource_clients/store_collection.py @@ -15,9 +15,16 @@ class StoreCollectionClient(ResourceClient): method on the `ApifyClient` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'store') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'store', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) def list( self, @@ -67,9 +74,16 @@ class StoreCollectionClientAsync(ResourceClientAsync): method on the `ApifyClientAsync` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'store') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'store', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) async def list( self, diff --git a/src/apify_client/_resource_clients/task_collection.py b/src/apify_client/_resource_clients/task_collection.py index b70bcae0..390d86e6 100644 --- a/src/apify_client/_resource_clients/task_collection.py +++ b/src/apify_client/_resource_clients/task_collection.py @@ -20,9 +20,16 @@ class TaskCollectionClient(ResourceClient): method on the `ApifyClient` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'actor-tasks') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'actor-tasks', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) def list( self, @@ -124,9 +131,16 @@ class TaskCollectionClientAsync(ResourceClientAsync): method on the `ApifyClientAsync` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'actor-tasks') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'actor-tasks', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) async def list( self, diff --git a/src/apify_client/_resource_clients/user.py b/src/apify_client/_resource_clients/user.py index 165242f8..2b7a9dd0 100644 --- a/src/apify_client/_resource_clients/user.py +++ b/src/apify_client/_resource_clients/user.py @@ -28,12 +28,18 @@ class UserClient(ResourceClient): an appropriate method on the `ApifyClient` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_id = kwargs.pop('resource_id', None) - if resource_id is None: - resource_id = 'me' - resource_path = kwargs.pop('resource_path', 'users') - super().__init__(*args, resource_id=resource_id, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_id: str | None = None, + resource_path: str = 'users', + **kwargs: Any, + ) -> None: + super().__init__( + resource_id=resource_id or 'me', + resource_path=resource_path, + **kwargs, + ) def get(self) -> UserPublicInfo | UserPrivateInfo | None: """Return information about user account. @@ -132,12 +138,18 @@ class UserClientAsync(ResourceClientAsync): an appropriate method on the `ApifyClientAsync` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_id = kwargs.pop('resource_id', None) - if resource_id is None: - resource_id = 'me' - resource_path = kwargs.pop('resource_path', 'users') - super().__init__(*args, resource_id=resource_id, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_id: str | None = None, + resource_path: str = 'users', + **kwargs: Any, + ) -> None: + super().__init__( + resource_id=resource_id or 'me', + resource_path=resource_path, + **kwargs, + ) async def get(self) -> UserPublicInfo | UserPrivateInfo | None: """Return information about user account. diff --git a/src/apify_client/_resource_clients/webhook.py b/src/apify_client/_resource_clients/webhook.py index bb70e23f..88796a47 100644 --- a/src/apify_client/_resource_clients/webhook.py +++ b/src/apify_client/_resource_clients/webhook.py @@ -27,9 +27,18 @@ class WebhookClient(ResourceClient): appropriate method on the `ApifyClient` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'webhooks') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_id: str, + resource_path: str = 'webhooks', + **kwargs: Any, + ) -> None: + super().__init__( + resource_id=resource_id, + resource_path=resource_path, + **kwargs, + ) def get(self) -> Webhook | None: """Retrieve the webhook. @@ -149,9 +158,18 @@ class WebhookClientAsync(ResourceClientAsync): appropriate method on the `ApifyClientAsync` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'webhooks') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_id: str, + resource_path: str = 'webhooks', + **kwargs: Any, + ) -> None: + super().__init__( + resource_id=resource_id, + resource_path=resource_path, + **kwargs, + ) async def get(self) -> Webhook | None: """Retrieve the webhook. diff --git a/src/apify_client/_resource_clients/webhook_collection.py b/src/apify_client/_resource_clients/webhook_collection.py index db4de310..f53e2815 100644 --- a/src/apify_client/_resource_clients/webhook_collection.py +++ b/src/apify_client/_resource_clients/webhook_collection.py @@ -20,9 +20,16 @@ class WebhookCollectionClient(ResourceClient): appropriate method on the `ApifyClient` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'webhooks') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'webhooks', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) def list( self, @@ -111,9 +118,16 @@ class WebhookCollectionClientAsync(ResourceClientAsync): appropriate method on the `ApifyClientAsync` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'webhooks') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'webhooks', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) async def list( self, diff --git a/src/apify_client/_resource_clients/webhook_dispatch.py b/src/apify_client/_resource_clients/webhook_dispatch.py index be9a8a6e..a7ac590d 100644 --- a/src/apify_client/_resource_clients/webhook_dispatch.py +++ b/src/apify_client/_resource_clients/webhook_dispatch.py @@ -15,9 +15,18 @@ class WebhookDispatchClient(ResourceClient): method on the `ApifyClient` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'webhook-dispatches') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_id: str, + resource_path: str = 'webhook-dispatches', + **kwargs: Any, + ) -> None: + super().__init__( + resource_id=resource_id, + resource_path=resource_path, + **kwargs, + ) def get(self) -> WebhookDispatch | None: """Retrieve the webhook dispatch. @@ -41,9 +50,18 @@ class WebhookDispatchClientAsync(ResourceClientAsync): method on the `ApifyClientAsync` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'webhook-dispatches') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_id: str, + resource_path: str = 'webhook-dispatches', + **kwargs: Any, + ) -> None: + super().__init__( + resource_id=resource_id, + resource_path=resource_path, + **kwargs, + ) async def get(self) -> WebhookDispatch | None: """Retrieve the webhook dispatch. diff --git a/src/apify_client/_resource_clients/webhook_dispatch_collection.py b/src/apify_client/_resource_clients/webhook_dispatch_collection.py index 7a70b4ad..d37d89a9 100644 --- a/src/apify_client/_resource_clients/webhook_dispatch_collection.py +++ b/src/apify_client/_resource_clients/webhook_dispatch_collection.py @@ -15,9 +15,16 @@ class WebhookDispatchCollectionClient(ResourceClient): `ApifyClient` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'webhook-dispatches') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'webhook-dispatches', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) def list( self, @@ -50,9 +57,16 @@ class WebhookDispatchCollectionClientAsync(ResourceClientAsync): `ApifyClientAsync` class. """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - resource_path = kwargs.pop('resource_path', 'webhook-dispatches') - super().__init__(*args, resource_path=resource_path, **kwargs) + def __init__( + self, + *, + resource_path: str = 'webhook-dispatches', + **kwargs: Any, + ) -> None: + super().__init__( + resource_path=resource_path, + **kwargs, + ) async def list( self, From 32e65488a421d4e339b32f985c89e38ec752f42d Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Wed, 25 Feb 2026 16:07:21 +0100 Subject: [PATCH 2/3] fix: Remove incorrect resource_id requirement from LogClient LogClient is a sub-resource client (e.g. /actor-runs/{id}/log) that does not receive its own resource_id from callers. Co-Authored-By: Claude Opus 4.6 --- src/apify_client/_resource_clients/log.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/apify_client/_resource_clients/log.py b/src/apify_client/_resource_clients/log.py index 7c1076cb..b319a87a 100644 --- a/src/apify_client/_resource_clients/log.py +++ b/src/apify_client/_resource_clients/log.py @@ -25,12 +25,10 @@ class LogClient(ResourceClient): def __init__( self, *, - resource_id: str, resource_path: str = 'logs', **kwargs: Any, ) -> None: super().__init__( - resource_id=resource_id, resource_path=resource_path, **kwargs, ) @@ -126,12 +124,10 @@ class LogClientAsync(ResourceClientAsync): def __init__( self, *, - resource_id: str, resource_path: str = 'logs', **kwargs: Any, ) -> None: super().__init__( - resource_id=resource_id, resource_path=resource_path, **kwargs, ) From e204bed8431ea52c37be8f6b4cf70068084e3fa5 Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Wed, 25 Feb 2026 16:16:42 +0100 Subject: [PATCH 3/3] fix: Make resource_id optional for clients used as sub-resources DatasetClient, KeyValueStoreClient, and RequestQueueClient are also used as sub-resources of runs (e.g. /actor-runs/{id}/dataset) where no resource_id is passed by callers. Co-Authored-By: Claude Opus 4.6 --- src/apify_client/_resource_clients/dataset.py | 4 ++-- src/apify_client/_resource_clients/key_value_store.py | 4 ++-- src/apify_client/_resource_clients/request_queue.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/apify_client/_resource_clients/dataset.py b/src/apify_client/_resource_clients/dataset.py index 707dd2e6..9c0668b6 100644 --- a/src/apify_client/_resource_clients/dataset.py +++ b/src/apify_client/_resource_clients/dataset.py @@ -69,7 +69,7 @@ class DatasetClient(ResourceClient): def __init__( self, *, - resource_id: str, + resource_id: str | None = None, resource_path: str = 'datasets', **kwargs: Any, ) -> None: @@ -699,7 +699,7 @@ class DatasetClientAsync(ResourceClientAsync): def __init__( self, *, - resource_id: str, + resource_id: str | None = None, resource_path: str = 'datasets', **kwargs: Any, ) -> None: diff --git a/src/apify_client/_resource_clients/key_value_store.py b/src/apify_client/_resource_clients/key_value_store.py index 65acf685..f61ecb23 100644 --- a/src/apify_client/_resource_clients/key_value_store.py +++ b/src/apify_client/_resource_clients/key_value_store.py @@ -80,7 +80,7 @@ class KeyValueStoreClient(ResourceClient): def __init__( self, *, - resource_id: str, + resource_id: str | None = None, resource_path: str = 'key-value-stores', **kwargs: Any, ) -> None: @@ -473,7 +473,7 @@ class KeyValueStoreClientAsync(ResourceClientAsync): def __init__( self, *, - resource_id: str, + resource_id: str | None = None, resource_path: str = 'key-value-stores', **kwargs: Any, ) -> None: diff --git a/src/apify_client/_resource_clients/request_queue.py b/src/apify_client/_resource_clients/request_queue.py index 7c22e502..f96c0030 100644 --- a/src/apify_client/_resource_clients/request_queue.py +++ b/src/apify_client/_resource_clients/request_queue.py @@ -63,7 +63,7 @@ class RequestQueueClient(ResourceClient): def __init__( # noqa: D417 self, *, - resource_id: str, + resource_id: str | None = None, resource_path: str = 'request-queues', client_key: str | None = None, **kwargs: Any, @@ -478,7 +478,7 @@ class RequestQueueClientAsync(ResourceClientAsync): def __init__( # noqa: D417 self, *, - resource_id: str, + resource_id: str | None = None, resource_path: str = 'request-queues', client_key: str | None = None, **kwargs: Any,