|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
3 | 3 | import asyncio |
4 | | -import logging |
5 | 4 | import math |
| 5 | +import warnings |
6 | 6 | from collections.abc import Iterable |
7 | 7 | from queue import Queue |
8 | 8 | from typing import TYPE_CHECKING, Any |
|
45 | 45 | from apify_client._models import GeneralAccess |
46 | 46 | from apify_client._types import Timeout |
47 | 47 |
|
48 | | - |
49 | | -logger = logging.getLogger(__name__) |
50 | | - |
51 | 48 | _RQ_MAX_REQUESTS_PER_BATCH = 25 |
52 | 49 | _MAX_PAYLOAD_SIZE_BYTES = 9 * 1024 * 1024 # 9 MB |
53 | 50 | _SAFETY_BUFFER_PERCENT = 0.01 / 100 # 0.01% |
@@ -394,9 +391,17 @@ def batch_add_requests( |
394 | 391 | Result containing lists of processed and unprocessed requests. |
395 | 392 | """ |
396 | 393 | if max_unprocessed_requests_retries: |
397 | | - logger.warning('`max_unprocessed_requests_retries` is deprecated and not used anymore.') |
| 394 | + warnings.warn( |
| 395 | + '`max_unprocessed_requests_retries` is deprecated and not used anymore.', |
| 396 | + DeprecationWarning, |
| 397 | + stacklevel=2, |
| 398 | + ) |
398 | 399 | if min_delay_between_unprocessed_requests_retries: |
399 | | - logger.warning('`min_delay_between_unprocessed_requests_retries` is deprecated and not used anymore.') |
| 400 | + warnings.warn( |
| 401 | + '`min_delay_between_unprocessed_requests_retries` is deprecated and not used anymore.', |
| 402 | + DeprecationWarning, |
| 403 | + stacklevel=2, |
| 404 | + ) |
400 | 405 |
|
401 | 406 | if max_parallel != 1: |
402 | 407 | raise NotImplementedError('max_parallel is only supported in async client') |
@@ -923,9 +928,17 @@ async def batch_add_requests( |
923 | 928 | Result containing lists of processed and unprocessed requests. |
924 | 929 | """ |
925 | 930 | if max_unprocessed_requests_retries: |
926 | | - logger.warning('`max_unprocessed_requests_retries` is deprecated and not used anymore.') |
| 931 | + warnings.warn( |
| 932 | + '`max_unprocessed_requests_retries` is deprecated and not used anymore.', |
| 933 | + DeprecationWarning, |
| 934 | + stacklevel=2, |
| 935 | + ) |
927 | 936 | if min_delay_between_unprocessed_requests_retries: |
928 | | - logger.warning('`min_delay_between_unprocessed_requests_retries` is deprecated and not used anymore.') |
| 937 | + warnings.warn( |
| 938 | + '`min_delay_between_unprocessed_requests_retries` is deprecated and not used anymore.', |
| 939 | + DeprecationWarning, |
| 940 | + stacklevel=2, |
| 941 | + ) |
929 | 942 |
|
930 | 943 | requests_as_dicts = [ |
931 | 944 | (RequestInput.model_validate(r) if isinstance(r, dict) else r).model_dump(by_alias=True, exclude_none=True) |
|
0 commit comments