scrapely-client-python 3.1.3__py3-none-any.whl

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.

Potentially problematic release.


This version of scrapely-client-python might be problematic. Click here for more details.

Files changed (65) hide show
  1. scrapely_client/__init__.py +30 -0
  2. scrapely_client/_charging.py +186 -0
  3. scrapely_client/_client_registry.py +136 -0
  4. scrapely_client/_consts.py +96 -0
  5. scrapely_client/_docs.py +37 -0
  6. scrapely_client/_literals.py +539 -0
  7. scrapely_client/_logging.py +180 -0
  8. scrapely_client/_models.py +4172 -0
  9. scrapely_client/_pagination.py +220 -0
  10. scrapely_client/_resource_clients/__init__.py +84 -0
  11. scrapely_client/_resource_clients/_resource_client.py +567 -0
  12. scrapely_client/_resource_clients/actor.py +1042 -0
  13. scrapely_client/_resource_clients/actor_collection.py +377 -0
  14. scrapely_client/_resource_clients/actor_env_var.py +154 -0
  15. scrapely_client/_resource_clients/actor_env_var_collection.py +165 -0
  16. scrapely_client/_resource_clients/actor_version.py +254 -0
  17. scrapely_client/_resource_clients/actor_version_collection.py +232 -0
  18. scrapely_client/_resource_clients/build.py +244 -0
  19. scrapely_client/_resource_clients/build_collection.py +164 -0
  20. scrapely_client/_resource_clients/dataset.py +1151 -0
  21. scrapely_client/_resource_clients/dataset_collection.py +244 -0
  22. scrapely_client/_resource_clients/key_value_store.py +906 -0
  23. scrapely_client/_resource_clients/key_value_store_collection.py +243 -0
  24. scrapely_client/_resource_clients/log.py +225 -0
  25. scrapely_client/_resource_clients/request_queue.py +1167 -0
  26. scrapely_client/_resource_clients/request_queue_collection.py +240 -0
  27. scrapely_client/_resource_clients/run.py +875 -0
  28. scrapely_client/_resource_clients/run_collection.py +226 -0
  29. scrapely_client/_resource_clients/schedule.py +243 -0
  30. scrapely_client/_resource_clients/schedule_collection.py +260 -0
  31. scrapely_client/_resource_clients/store_collection.py +242 -0
  32. scrapely_client/_resource_clients/task.py +793 -0
  33. scrapely_client/_resource_clients/task_collection.py +322 -0
  34. scrapely_client/_resource_clients/user.py +262 -0
  35. scrapely_client/_resource_clients/webhook.py +292 -0
  36. scrapely_client/_resource_clients/webhook_collection.py +281 -0
  37. scrapely_client/_resource_clients/webhook_dispatch.py +84 -0
  38. scrapely_client/_resource_clients/webhook_dispatch_collection.py +158 -0
  39. scrapely_client/_scrapely_client.py +837 -0
  40. scrapely_client/_statistics.py +29 -0
  41. scrapely_client/_status_message_watcher.py +197 -0
  42. scrapely_client/_streamed_log.py +250 -0
  43. scrapely_client/_typeddicts.py +408 -0
  44. scrapely_client/_utils/__init__.py +0 -0
  45. scrapely_client/_utils/crypto.py +87 -0
  46. scrapely_client/_utils/encoding.py +133 -0
  47. scrapely_client/_utils/errors.py +33 -0
  48. scrapely_client/_utils/http.py +137 -0
  49. scrapely_client/_utils/time.py +32 -0
  50. scrapely_client/_utils/try_import.py +61 -0
  51. scrapely_client/errors.py +190 -0
  52. scrapely_client/http_clients/__init__.py +10 -0
  53. scrapely_client/http_clients/_base.py +430 -0
  54. scrapely_client/http_clients/_impit.py +598 -0
  55. scrapely_client/http_compressors/__init__.py +18 -0
  56. scrapely_client/http_compressors/_base.py +25 -0
  57. scrapely_client/http_compressors/_brotli.py +38 -0
  58. scrapely_client/http_compressors/_gzip.py +38 -0
  59. scrapely_client/http_compressors/_resolve.py +38 -0
  60. scrapely_client/py.typed +0 -0
  61. scrapely_client/types.py +52 -0
  62. scrapely_client_python-3.1.3.dist-info/METADATA +269 -0
  63. scrapely_client_python-3.1.3.dist-info/RECORD +65 -0
  64. scrapely_client_python-3.1.3.dist-info/WHEEL +4 -0
  65. scrapely_client_python-3.1.3.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,158 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING, Any
4
+
5
+ from scrapely_client._docs import docs_group
6
+ from scrapely_client._models import ListOfWebhookDispatches, ListOfWebhookDispatchesResponse
7
+ from scrapely_client._pagination import get_items_iterator, get_items_iterator_async
8
+ from scrapely_client._resource_clients._resource_client import ResourceClient, ResourceClientAsync
9
+
10
+ if TYPE_CHECKING:
11
+ from collections.abc import AsyncIterator, Iterator
12
+
13
+ from scrapely_client._models import WebhookDispatch
14
+ from scrapely_client.types import Timeout
15
+
16
+
17
+ @docs_group('Resource clients')
18
+ class WebhookDispatchCollectionClient(ResourceClient):
19
+ """Sub-client for the webhook dispatch collection.
20
+
21
+ Provides methods to manage webhook dispatches, e.g. list them. Obtain an instance via an appropriate method on the
22
+ `ApifyClient` class.
23
+ """
24
+
25
+ def __init__(
26
+ self,
27
+ *,
28
+ resource_path: str = 'webhook-dispatches',
29
+ **kwargs: Any,
30
+ ) -> None:
31
+ super().__init__(
32
+ resource_path=resource_path,
33
+ **kwargs,
34
+ )
35
+
36
+ def list(
37
+ self,
38
+ *,
39
+ limit: int | None = None,
40
+ offset: int | None = None,
41
+ desc: bool | None = None,
42
+ timeout: Timeout = 'medium',
43
+ ) -> ListOfWebhookDispatches:
44
+ """List all webhook dispatches of a user.
45
+
46
+
47
+ Args:
48
+ limit: How many webhook dispatches to retrieve.
49
+ offset: What webhook dispatch to include as first when retrieving the list.
50
+ desc: Whether to sort the webhook dispatches in descending order based on the date of their creation.
51
+ timeout: Timeout for the API HTTP request.
52
+
53
+ Returns:
54
+ The retrieved webhook dispatches of a user.
55
+ """
56
+ result = self._list(timeout=timeout, limit=limit, offset=offset, desc=desc)
57
+ return ListOfWebhookDispatchesResponse.model_validate(result).data
58
+
59
+ def iterate(
60
+ self,
61
+ *,
62
+ limit: int | None = None,
63
+ offset: int | None = None,
64
+ desc: bool | None = None,
65
+ timeout: Timeout = 'medium',
66
+ ) -> Iterator[WebhookDispatch]:
67
+ """Iterate over all webhook dispatches of a user.
68
+
69
+ Simple `list` does only one API call, possibly not listing all items matching the criteria. This method
70
+ returns an iterator that is capable of making multiple API calls to retrieve all items matching the criteria.
71
+
72
+
73
+ Args:
74
+ limit: How many webhook dispatches to retrieve.
75
+ offset: What webhook dispatch to include as first when retrieving the list.
76
+ desc: Whether to sort the webhook dispatches in descending order based on the date of their creation.
77
+ timeout: Timeout for the API HTTP request.
78
+
79
+ Yields:
80
+ The webhook dispatches of a user matching the specified filters.
81
+ """
82
+
83
+ def _callback(*, limit: int | None = None, offset: int | None = None) -> ListOfWebhookDispatches:
84
+ return self.list(limit=limit, offset=offset, desc=desc, timeout=timeout)
85
+
86
+ return get_items_iterator(_callback, limit=limit, offset=offset)
87
+
88
+
89
+ @docs_group('Resource clients')
90
+ class WebhookDispatchCollectionClientAsync(ResourceClientAsync):
91
+ """Sub-client for the webhook dispatch collection.
92
+
93
+ Provides methods to manage webhook dispatches, e.g. list them. Obtain an instance via an appropriate method on the
94
+ `ApifyClientAsync` class.
95
+ """
96
+
97
+ def __init__(
98
+ self,
99
+ *,
100
+ resource_path: str = 'webhook-dispatches',
101
+ **kwargs: Any,
102
+ ) -> None:
103
+ super().__init__(
104
+ resource_path=resource_path,
105
+ **kwargs,
106
+ )
107
+
108
+ async def list(
109
+ self,
110
+ *,
111
+ limit: int | None = None,
112
+ offset: int | None = None,
113
+ desc: bool | None = None,
114
+ timeout: Timeout = 'medium',
115
+ ) -> ListOfWebhookDispatches:
116
+ """List all webhook dispatches of a user.
117
+
118
+
119
+ Args:
120
+ limit: How many webhook dispatches to retrieve.
121
+ offset: What webhook dispatch to include as first when retrieving the list.
122
+ desc: Whether to sort the webhook dispatches in descending order based on the date of their creation.
123
+ timeout: Timeout for the API HTTP request.
124
+
125
+ Returns:
126
+ The retrieved webhook dispatches of a user.
127
+ """
128
+ result = await self._list(timeout=timeout, limit=limit, offset=offset, desc=desc)
129
+ return ListOfWebhookDispatchesResponse.model_validate(result).data
130
+
131
+ def iterate(
132
+ self,
133
+ *,
134
+ limit: int | None = None,
135
+ offset: int | None = None,
136
+ desc: bool | None = None,
137
+ timeout: Timeout = 'medium',
138
+ ) -> AsyncIterator[WebhookDispatch]:
139
+ """Iterate over all webhook dispatches of a user.
140
+
141
+ Simple `list` does only one API call, possibly not listing all items matching the criteria. This method
142
+ returns an iterator that is capable of making multiple API calls to retrieve all items matching the criteria.
143
+
144
+
145
+ Args:
146
+ limit: How many webhook dispatches to retrieve.
147
+ offset: What webhook dispatch to include as first when retrieving the list.
148
+ desc: Whether to sort the webhook dispatches in descending order based on the date of their creation.
149
+ timeout: Timeout for the API HTTP request.
150
+
151
+ Yields:
152
+ The webhook dispatches of a user matching the specified filters.
153
+ """
154
+
155
+ async def _callback(*, limit: int | None = None, offset: int | None = None) -> ListOfWebhookDispatches:
156
+ return await self.list(limit=limit, offset=offset, desc=desc, timeout=timeout)
157
+
158
+ return get_items_iterator_async(_callback, limit=limit, offset=offset)