|
22 | 22 | import impit |
23 | 23 | from typing_extensions import Self |
24 | 24 |
|
| 25 | + from apify_client._models import Run |
25 | 26 | from apify_client._resource_clients import RunClient, RunClientAsync |
26 | 27 |
|
27 | 28 |
|
@@ -404,25 +405,25 @@ def __init__(self, *, to_logger: logging.Logger, check_period: timedelta = timed |
404 | 405 | self._check_period = check_period.total_seconds() |
405 | 406 | self._last_status_message = '' |
406 | 407 |
|
407 | | - def _log_run_data(self, run_data: dict[str, Any] | None) -> bool: |
| 408 | + def _log_run_data(self, run_data: Run | None) -> bool: |
408 | 409 | """Get relevant run data, log them if changed and return `True` if more data is expected. |
409 | 410 |
|
410 | 411 | Args: |
411 | | - run_data: The dictionary that contains the run data. |
| 412 | + run_data: The Run model that contains the run data. |
412 | 413 |
|
413 | 414 | Returns: |
414 | 415 | `True` if more data is expected, `False` otherwise. |
415 | 416 | """ |
416 | 417 | if run_data is not None: |
417 | | - status = run_data.get('status', 'Unknown status') |
418 | | - status_message = run_data.get('statusMessage', '') |
| 418 | + status = run_data.status if run_data.status else 'Unknown status' |
| 419 | + status_message = run_data.status_message or '' |
419 | 420 | new_status_message = f'Status: {status}, Message: {status_message}' |
420 | 421 |
|
421 | 422 | if new_status_message != self._last_status_message: |
422 | 423 | self._last_status_message = new_status_message |
423 | 424 | self._to_logger.info(new_status_message) |
424 | 425 |
|
425 | | - return not (run_data.get('isStatusMessageTerminal', False)) |
| 426 | + return not (run_data.is_status_message_terminal or False) |
426 | 427 | return True |
427 | 428 |
|
428 | 429 |
|
|
0 commit comments