Skip to content

Commit 1e8b169

Browse files
committed
Update
1 parent ef3bdb3 commit 1e8b169

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

src/apify_client/_resource_clients/run.py

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ def get(self) -> Run | None:
5151
Returns:
5252
The retrieved Actor run data.
5353
"""
54-
result = self._get()
54+
response = self._get()
5555

56-
if result is None:
56+
if response is None:
5757
return None
5858

59-
return RunResponse.model_validate(result).data
59+
return RunResponse.model_validate(response).data
6060

6161
def update(
6262
self,
@@ -83,8 +83,8 @@ def update(
8383
'generalAccess': general_access,
8484
}
8585

86-
result = self._update(filter_out_none_values_recursively(updated_fields))
87-
return Run.model_validate(result)
86+
response = self._update(filter_out_none_values_recursively(updated_fields))
87+
return Run.model_validate(response)
8888

8989
def delete(self) -> None:
9090
"""Delete the run.
@@ -106,8 +106,8 @@ def abort(self, *, gracefully: bool | None = None) -> Run:
106106
Returns:
107107
The data of the aborted Actor run.
108108
"""
109-
result = self._abort(gracefully=gracefully)
110-
return Run.model_validate(result)
109+
response = self._abort(gracefully=gracefully)
110+
return Run.model_validate(response)
111111

112112
def wait_for_finish(self, *, wait_secs: int | None = None) -> Run | None:
113113
"""Wait synchronously until the run finishes or the server times out.
@@ -119,8 +119,12 @@ def wait_for_finish(self, *, wait_secs: int | None = None) -> Run | None:
119119
The Actor run data. If the status on the object is not one of the terminal statuses (SUCCEEDED, FAILED,
120120
TIMED_OUT, ABORTED), then the run has not yet finished.
121121
"""
122-
result = self._wait_for_finish(wait_secs=wait_secs)
123-
return Run.model_validate(result) if result is not None else None
122+
response = self._wait_for_finish(wait_secs=wait_secs)
123+
124+
if response is None:
125+
return None
126+
127+
return Run.model_validate(response)
124128

125129
def metamorph(
126130
self,
@@ -384,12 +388,12 @@ async def get(self) -> Run | None:
384388
Returns:
385389
The retrieved Actor run data.
386390
"""
387-
result = await self._get()
391+
response = await self._get()
388392

389-
if result is None:
393+
if response is None:
390394
return None
391395

392-
return RunResponse.model_validate(result).data
396+
return RunResponse.model_validate(response).data
393397

394398
async def update(
395399
self,
@@ -416,8 +420,8 @@ async def update(
416420
'generalAccess': general_access,
417421
}
418422

419-
result = await self._update(filter_out_none_values_recursively(updated_fields))
420-
return Run.model_validate(result)
423+
response = await self._update(filter_out_none_values_recursively(updated_fields))
424+
return RunResponse.model_validate(response).data
421425

422426
async def abort(self, *, gracefully: bool | None = None) -> Run:
423427
"""Abort the Actor run which is starting or currently running and return its details.
@@ -432,8 +436,8 @@ async def abort(self, *, gracefully: bool | None = None) -> Run:
432436
Returns:
433437
The data of the aborted Actor run.
434438
"""
435-
result = await self._abort(gracefully=gracefully)
436-
return Run.model_validate(result)
439+
response = await self._abort(gracefully=gracefully)
440+
return RunResponse.model_validate(response).data
437441

438442
async def wait_for_finish(self, *, wait_secs: int | None = None) -> Run | None:
439443
"""Wait synchronously until the run finishes or the server times out.
@@ -445,8 +449,8 @@ async def wait_for_finish(self, *, wait_secs: int | None = None) -> Run | None:
445449
The Actor run data. If the status on the object is not one of the terminal statuses (SUCCEEDED, FAILED,
446450
TIMED_OUT, ABORTED), then the run has not yet finished.
447451
"""
448-
result = await self._wait_for_finish(wait_secs=wait_secs)
449-
return Run.model_validate(result) if result is not None else None
452+
response = await self._wait_for_finish(wait_secs=wait_secs)
453+
return Run.model_validate(response) if response is not None else None
450454

451455
async def delete(self) -> None:
452456
"""Delete the run.

src/apify_client/_resource_clients/webhook_collection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from typing import TYPE_CHECKING, Any
44

5-
from apify_client._models import Webhook, WebhookShort
5+
from apify_client._models import CreateWebhookResponse, Webhook, WebhookShort
66
from apify_client._resource_clients.base import ResourceCollectionClient, ResourceCollectionClientAsync
77
from apify_client._resource_clients.webhook import get_webhook_representation
88
from apify_client._utils import filter_out_none_values_recursively
@@ -179,5 +179,5 @@ async def create(
179179
is_ad_hoc=is_ad_hoc,
180180
)
181181

182-
result = await self._create(filter_out_none_values_recursively(webhook_representation))
183-
return Webhook.model_validate(result)
182+
response = await self._create(filter_out_none_values_recursively(webhook_representation))
183+
return CreateWebhookResponse.model_validate(response).data

0 commit comments

Comments
 (0)