scrapely-client-python 1.0.12__tar.gz → 1.0.13__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/CHANGELOG.md +6 -0
  2. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/PKG-INFO +1 -1
  3. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/pyproject.toml +1 -1
  4. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/pyproject.toml.orig +1 -1
  5. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_charging.py +14 -1
  6. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_credit_unlock.py +1 -1
  7. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/run.py +4 -4
  8. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_scrapely_client.py +16 -20
  9. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/errors.py +19 -20
  10. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/CONTRIBUTING.md +0 -0
  11. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/LICENSE +0 -0
  12. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/NOTICE +0 -0
  13. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/README.md +0 -0
  14. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/__init__.py +0 -0
  15. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_client_registry.py +0 -0
  16. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_consts.py +0 -0
  17. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_docs.py +0 -0
  18. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_literals.py +0 -0
  19. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_logging.py +0 -0
  20. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_models.py +0 -0
  21. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_pagination.py +0 -0
  22. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/__init__.py +0 -0
  23. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/_resource_client.py +0 -0
  24. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/actor.py +0 -0
  25. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/actor_collection.py +0 -0
  26. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/actor_env_var.py +0 -0
  27. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/actor_env_var_collection.py +0 -0
  28. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/actor_version.py +0 -0
  29. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/actor_version_collection.py +0 -0
  30. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/automation.py +0 -0
  31. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/automation_collection.py +0 -0
  32. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/build.py +0 -0
  33. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/build_collection.py +0 -0
  34. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/dataset.py +0 -0
  35. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/dataset_collection.py +0 -0
  36. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/key_value_store.py +0 -0
  37. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/key_value_store_collection.py +0 -0
  38. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/log.py +0 -0
  39. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/request_queue.py +0 -0
  40. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/request_queue_collection.py +0 -0
  41. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/run_collection.py +0 -0
  42. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/schedule.py +0 -0
  43. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/schedule_collection.py +0 -0
  44. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/store_collection.py +0 -0
  45. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/task.py +0 -0
  46. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/task_collection.py +0 -0
  47. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/user.py +0 -0
  48. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/webhook.py +0 -0
  49. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/webhook_collection.py +0 -0
  50. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/webhook_dispatch.py +0 -0
  51. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_resource_clients/webhook_dispatch_collection.py +0 -0
  52. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_statistics.py +0 -0
  53. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_status_message_watcher.py +0 -0
  54. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_streamed_log.py +0 -0
  55. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_typeddicts.py +0 -0
  56. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_utils/__init__.py +0 -0
  57. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_utils/crypto.py +0 -0
  58. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_utils/encoding.py +0 -0
  59. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_utils/errors.py +0 -0
  60. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_utils/http.py +0 -0
  61. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_utils/time.py +0 -0
  62. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/_utils/try_import.py +0 -0
  63. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/http_clients/__init__.py +0 -0
  64. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/http_clients/_base.py +0 -0
  65. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/http_clients/_impit.py +0 -0
  66. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/http_compressors/__init__.py +0 -0
  67. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/http_compressors/_base.py +0 -0
  68. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/http_compressors/_brotli.py +0 -0
  69. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/http_compressors/_gzip.py +0 -0
  70. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/http_compressors/_resolve.py +0 -0
  71. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/py.typed +0 -0
  72. {scrapely_client_python-1.0.12 → scrapely_client_python-1.0.13}/src/scrapely_client/types.py +0 -0
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.0.13] - 2026-11-18
6
+
7
+ - Run logs printed by `ActorClient.call()`, `RunClient.get_streamed_log()` and `RunClient.get_status_message_watcher()` (sync and async) now carry the prefix `[scrapely.<actor> runId:<id>]` instead of `[apify.<actor> runId:<id>]`. The default redirect logger is named `scrapely.<actor> runId:<id>`; code that configured the `apify` logger hierarchy for these lines should use `scrapely` instead.
8
+ - The client and error classes are now named `ScrapelyClient`, `ScrapelyClientAsync`, `ScrapelyApiError` and `ScrapelyClientError`, so `help()`, `repr()` and tracebacks show those names. `ApifyClient`, `ApifyClientAsync`, `ApifyApiError` and `ApifyClientError` stay importable as aliases of the same classes: existing imports, `isinstance` checks and `except` handlers keep working.
9
+ - Charged dataset pushes: the default dataset's client asks the charging hooks on every push whether to charge, not only when the client was created, so pricing that loads later and a spending limit reached during the run apply to the next push (sync and async).
10
+
5
11
  ## [1.0.12] - 2026-11-06
6
12
 
7
13
  - Out of credit: the API's 402 for the account balance keeps its type and status and now carries the way out in `error.data` (`ApifyApiError.data`, model `InsufficientCreditErrorData`): a Free account gets `unlock` (Starter, its price and credit, and `checkoutUrl`), a paid account `topUpUrl`, plus the account's newest held run (`heldItems`, `heldUntil`, `runId`). `is_insufficient_credit_error(err)` and `credit_unlock_url(err)` read it.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scrapely-client-python
3
- Version: 1.0.12
3
+ Version: 1.0.13
4
4
  Summary: Scrapely API client for Python
5
5
  Keywords: scrapely,api,client,automation,crawling,scraping
6
6
  Author: TeraShift GmbH (Scrape.ly)
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "scrapely-client-python"
7
- version = "1.0.12"
7
+ version = "1.0.13"
8
8
  description = "Scrapely API client for Python"
9
9
  license = "Apache-2.0"
10
10
  license-files = [
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "scrapely-client-python"
7
- version = "1.0.12"
7
+ version = "1.0.13"
8
8
  description = "Scrapely API client for Python"
9
9
  authors = [{ name = "TeraShift GmbH (Scrape.ly)" }]
10
10
  license = "Apache-2.0"
@@ -122,7 +122,9 @@ def _merge_context_charge_result(context: PpeAwarePushDataContext, hooks: Chargi
122
122
  context.charge_result = hooks.merge_charge_results(context.charge_result, result)
123
123
 
124
124
 
125
- def wrap_dataset_client_with_charging(client: Any, hooks: ChargingHooks, *, is_async: bool) -> Any:
125
+ def wrap_dataset_client_with_charging(
126
+ client: Any, hooks: ChargingHooks, *, is_async: bool, dataset_id: str | None = None
127
+ ) -> Any:
126
128
  """Wrap a dataset client's ``push_items`` with charging interception (method swap by design).
127
129
 
128
130
  Normalize items →
@@ -132,9 +134,17 @@ def wrap_dataset_client_with_charging(client: Any, hooks: ChargingHooks, *, is_a
132
134
  """
133
135
  original_push_items = client.push_items
134
136
 
137
+ def _charges() -> bool:
138
+ # Asked on every push, not when the client was created: pricing loads and
139
+ # the spending limit is reached after a client may already exist.
140
+ return dataset_id is None or hooks.should_charge_dataset_pushes(dataset_id)
141
+
135
142
  if is_async:
136
143
 
137
144
  async def patched_push_items(items: Any, **kwargs: Any) -> None:
145
+ if not _charges():
146
+ await original_push_items(items, **kwargs)
147
+ return
138
148
  context = push_data_charging_context.get()
139
149
  normalized = normalize_items(items)
140
150
 
@@ -153,6 +163,9 @@ def wrap_dataset_client_with_charging(client: Any, hooks: ChargingHooks, *, is_a
153
163
  else:
154
164
 
155
165
  def patched_push_items(items: Any, **kwargs: Any) -> None:
166
+ if not _charges():
167
+ original_push_items(items, **kwargs)
168
+ return
156
169
  context = push_data_charging_context.get()
157
170
  normalized = normalize_items(items)
158
171
 
@@ -2,7 +2,7 @@
2
2
  """Read the unlock data of an "out of credit" answer and warn about held results.
3
3
 
4
4
  When the account's free credit runs out, the API answers run starts (and other paid requests) with HTTP 402 and puts
5
- the way out in `error.data` (`ApifyApiError.data`): `unlock` (the Starter offer and its `checkoutUrl`) for a Free
5
+ the way out in `error.data` (`ScrapelyApiError.data`): `unlock` (the Starter offer and its `checkoutUrl`) for a Free
6
6
  account, `topUpUrl` for a paid one, and the account's newest held run (`heldItems`, `heldUntil`, `runId`). A run
7
7
  that went on finding results after the credit ran out has `held` (`RunHeld`): the results are kept out of its
8
8
  dataset until the account unlocks them.
@@ -369,7 +369,7 @@ class RunClient(ResourceClient):
369
369
 
370
370
  if not to_logger:
371
371
  name = ' '.join(part for part in (actor_name, run_id) if part)
372
- to_logger = create_redirect_logger(f'apify.{name}')
372
+ to_logger = create_redirect_logger(f'scrapely.{name}')
373
373
 
374
374
  return StreamedLog(log_client=self.log(), to_logger=to_logger, from_start=from_start)
375
375
 
@@ -456,7 +456,7 @@ class RunClient(ResourceClient):
456
456
 
457
457
  if not to_logger:
458
458
  name = ' '.join(part for part in (actor_name, run_id) if part)
459
- to_logger = create_redirect_logger(f'apify.{name}')
459
+ to_logger = create_redirect_logger(f'scrapely.{name}')
460
460
 
461
461
  return StatusMessageWatcher(run_client=self, to_logger=to_logger, check_period=check_period)
462
462
 
@@ -791,7 +791,7 @@ class RunClientAsync(ResourceClientAsync):
791
791
 
792
792
  if not to_logger:
793
793
  name = ' '.join(part for part in (actor_name, run_id) if part)
794
- to_logger = create_redirect_logger(f'apify.{name}')
794
+ to_logger = create_redirect_logger(f'scrapely.{name}')
795
795
 
796
796
  return StreamedLogAsync(log_client=self.log(), to_logger=to_logger, from_start=from_start)
797
797
 
@@ -879,6 +879,6 @@ class RunClientAsync(ResourceClientAsync):
879
879
 
880
880
  if not to_logger:
881
881
  name = ' '.join(part for part in (actor_name, run_id) if part)
882
- to_logger = create_redirect_logger(f'apify.{name}')
882
+ to_logger = create_redirect_logger(f'scrapely.{name}')
883
883
 
884
884
  return StatusMessageWatcherAsync(run_client=self, to_logger=to_logger, check_period=check_period)
@@ -100,7 +100,7 @@ def _resolve_api_url(api_url: str | None) -> str:
100
100
 
101
101
 
102
102
  @docs_group('Scrapely API clients')
103
- class ApifyClient:
103
+ class ScrapelyClient:
104
104
  """Synchronous client for the Scrapely API.
105
105
 
106
106
  This is the main entry point for interacting with the Scrapely platform. It provides methods to access
@@ -246,7 +246,7 @@ class ApifyClient:
246
246
  api_url: str | None = None,
247
247
  api_public_url: str | None = DEFAULT_API_URL,
248
248
  http_client: HttpClient,
249
- ) -> ApifyClient:
249
+ ) -> ScrapelyClient:
250
250
  """Create an `ScrapelyClient` instance with a custom HTTP client.
251
251
 
252
252
  Use this alternative constructor when you want to provide your own HTTP client implementation
@@ -364,12 +364,10 @@ class ApifyClient:
364
364
  dataset_id: ID of the dataset to be manipulated.
365
365
  """
366
366
  dataset_client = DatasetClient(resource_id=dataset_id, **self._base_kwargs)
367
- if (
368
- self._charging_hooks is not None
369
- and dataset_id == self._default_dataset_id
370
- and self._charging_hooks.should_charge_dataset_pushes(dataset_id)
371
- ):
372
- return wrap_dataset_client_with_charging(dataset_client, self._charging_hooks, is_async=False)
367
+ if self._charging_hooks is not None and dataset_id == self._default_dataset_id:
368
+ return wrap_dataset_client_with_charging(
369
+ dataset_client, self._charging_hooks, is_async=False, dataset_id=dataset_id
370
+ )
373
371
  return dataset_client
374
372
 
375
373
  def datasets(self) -> DatasetCollectionClient:
@@ -483,7 +481,7 @@ class ApifyClient:
483
481
 
484
482
 
485
483
  @docs_group('Scrapely API clients')
486
- class ApifyClientAsync:
484
+ class ScrapelyClientAsync:
487
485
  """Asynchronous client for the Scrapely API.
488
486
 
489
487
  This is the main entry point for interacting with the Scrapely platform using async/await. It provides
@@ -636,7 +634,7 @@ class ApifyClientAsync:
636
634
  api_url: str | None = None,
637
635
  api_public_url: str | None = DEFAULT_API_URL,
638
636
  http_client: HttpClientAsync,
639
- ) -> ApifyClientAsync:
637
+ ) -> ScrapelyClientAsync:
640
638
  """Create an `ScrapelyClientAsync` instance with a custom HTTP client.
641
639
 
642
640
  Use this alternative constructor when you want to provide your own HTTP client implementation
@@ -753,12 +751,10 @@ class ApifyClientAsync:
753
751
  dataset_id: ID of the dataset to be manipulated.
754
752
  """
755
753
  dataset_client = DatasetClientAsync(resource_id=dataset_id, **self._base_kwargs)
756
- if (
757
- self._charging_hooks is not None
758
- and dataset_id == self._default_dataset_id
759
- and self._charging_hooks.should_charge_dataset_pushes(dataset_id)
760
- ):
761
- return wrap_dataset_client_with_charging(dataset_client, self._charging_hooks, is_async=True)
754
+ if self._charging_hooks is not None and dataset_id == self._default_dataset_id:
755
+ return wrap_dataset_client_with_charging(
756
+ dataset_client, self._charging_hooks, is_async=True, dataset_id=dataset_id
757
+ )
762
758
  return dataset_client
763
759
 
764
760
  def datasets(self) -> DatasetCollectionClientAsync:
@@ -871,8 +867,8 @@ class ApifyClientAsync:
871
867
  return StoreCollectionClientAsync(**self._base_kwargs)
872
868
 
873
869
 
874
- ScrapelyClient = ApifyClient
875
- """Primary name of the client; ``ApifyClient`` is kept as a drop-in compatibility alias."""
870
+ ApifyClient = ScrapelyClient
871
+ """Compatibility alias of `ScrapelyClient` (the same class), kept so existing imports keep working."""
876
872
 
877
- ScrapelyClientAsync = ApifyClientAsync
878
- """Primary name of the async client; ``ApifyClientAsync`` is kept as a drop-in compatibility alias."""
873
+ ApifyClientAsync = ScrapelyClientAsync
874
+ """Compatibility alias of `ScrapelyClientAsync` (the same class), kept so existing imports keep working."""
@@ -14,17 +14,17 @@ if TYPE_CHECKING:
14
14
 
15
15
 
16
16
  @docs_group('Errors')
17
- class ApifyClientError(Exception):
17
+ class ScrapelyClientError(Exception):
18
18
  """Base class for all Scrapely API client errors."""
19
19
 
20
20
 
21
21
  @docs_group('Errors')
22
- class ApifyApiError(ApifyClientError):
22
+ class ScrapelyApiError(ScrapelyClientError):
23
23
  """Error raised when the Scrapely API returns an error response.
24
24
 
25
- Instantiating `ApifyApiError` dispatches to the subclass matching the HTTP status code (e.g. 404 → `NotFoundError`,
26
- any 5xx → `ServerError`). Unmapped statuses stay on `ApifyApiError`. Existing `except ApifyApiError` handlers keep
27
- working because every subclass inherits from this class.
25
+ Instantiating `ScrapelyApiError` dispatches to the subclass matching the HTTP status code (e.g. 404 →
26
+ `NotFoundError`, any 5xx → `ServerError`). Unmapped statuses stay on `ScrapelyApiError`. Existing
27
+ `except ScrapelyApiError` handlers keep working because every subclass inherits from this class.
28
28
 
29
29
  The `type`, `message` and `data` fields from the response body are exposed for inspection but are treated as
30
30
  non-authoritative metadata — dispatch is driven by the status code only.
@@ -44,7 +44,7 @@ class ApifyApiError(ApifyClientError):
44
44
  def __new__(cls, response: HttpResponse, attempt: int, *, method: str = 'GET') -> Self: # noqa: ARG004
45
45
  """Dispatch to the subclass matching the response's HTTP status code, if any."""
46
46
  instance = super().__new__(cls)
47
- if cls is ApifyApiError:
47
+ if cls is ScrapelyApiError:
48
48
  status = response.status_code
49
49
  mapped = _STATUS_TO_CLASS.get(status)
50
50
  if mapped is None and status >= HTTPStatus.INTERNAL_SERVER_ERROR:
@@ -98,32 +98,32 @@ class ApifyApiError(ApifyClientError):
98
98
 
99
99
 
100
100
  @docs_group('Errors')
101
- class InvalidRequestError(ApifyApiError):
101
+ class InvalidRequestError(ScrapelyApiError):
102
102
  """Raised when the Scrapely API returns an HTTP 400 Bad Request response."""
103
103
 
104
104
 
105
105
  @docs_group('Errors')
106
- class UnauthorizedError(ApifyApiError):
106
+ class UnauthorizedError(ScrapelyApiError):
107
107
  """Raised when the Scrapely API returns an HTTP 401 Unauthorized response."""
108
108
 
109
109
 
110
110
  @docs_group('Errors')
111
- class ForbiddenError(ApifyApiError):
111
+ class ForbiddenError(ScrapelyApiError):
112
112
  """Raised when the Scrapely API returns an HTTP 403 Forbidden response."""
113
113
 
114
114
 
115
115
  @docs_group('Errors')
116
- class NotFoundError(ApifyApiError):
116
+ class NotFoundError(ScrapelyApiError):
117
117
  """Raised when the Scrapely API returns an HTTP 404 Not Found response."""
118
118
 
119
119
 
120
120
  @docs_group('Errors')
121
- class ConflictError(ApifyApiError):
121
+ class ConflictError(ScrapelyApiError):
122
122
  """Raised when the Scrapely API returns an HTTP 409 Conflict response."""
123
123
 
124
124
 
125
125
  @docs_group('Errors')
126
- class RateLimitError(ApifyApiError):
126
+ class RateLimitError(ScrapelyApiError):
127
127
  """Raised when the Scrapely API returns an HTTP 429 Too Many Requests response.
128
128
 
129
129
  Rate-limited requests are retried automatically; this error is only raised after all retry attempts have been
@@ -132,7 +132,7 @@ class RateLimitError(ApifyApiError):
132
132
 
133
133
 
134
134
  @docs_group('Errors')
135
- class ServerError(ApifyApiError):
135
+ class ServerError(ScrapelyApiError):
136
136
  """Raised when the Scrapely API returns an HTTP 5xx response.
137
137
 
138
138
  Server errors are retried automatically; this error is only raised after all retry attempts have been exhausted.
@@ -140,7 +140,7 @@ class ServerError(ApifyApiError):
140
140
 
141
141
 
142
142
  @docs_group('Errors')
143
- class InvalidResponseBodyError(ApifyClientError):
143
+ class InvalidResponseBodyError(ScrapelyClientError):
144
144
  """Error raised when a response body cannot be parsed.
145
145
 
146
146
  This occurs when the API returns a body that does not match its content type, for example a malformed JSON
@@ -160,13 +160,12 @@ class InvalidResponseBodyError(ApifyClientError):
160
160
  self.response = response
161
161
 
162
162
 
163
- # Scrapely-named aliases for the error classes. The original class names stay part of the
164
- # client's backward-compatibility contract (existing code keeps working); these aliases let
165
- # Scrapely-native code use the platform name.
166
- ScrapelyApiError = ApifyApiError
167
- ScrapelyClientError = ApifyClientError
163
+ # Compatibility aliases (the same classes). The earlier class names stay part of the client's
164
+ # backward-compatibility contract, so existing imports and `except ApifyApiError` handlers keep working.
165
+ ApifyApiError = ScrapelyApiError
166
+ ApifyClientError = ScrapelyClientError
168
167
 
169
- _STATUS_TO_CLASS: dict[int, type[ApifyApiError]] = {
168
+ _STATUS_TO_CLASS: dict[int, type[ScrapelyApiError]] = {
170
169
  400: InvalidRequestError,
171
170
  401: UnauthorizedError,
172
171
  403: ForbiddenError,