apify-client 3.2.2b9__tar.gz → 3.2.2b11__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 (70) hide show
  1. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/CHANGELOG.md +2 -0
  2. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/PKG-INFO +1 -1
  3. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/pyproject.toml +1 -1
  4. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/pyproject.toml.orig +1 -1
  5. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/actor.py +8 -0
  6. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/actor_collection.py +9 -0
  7. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_utils/http.py +18 -3
  8. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/errors.py +3 -2
  9. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/http_clients/_base.py +5 -1
  10. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/CONTRIBUTING.md +0 -0
  11. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/LICENSE +0 -0
  12. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/README.md +0 -0
  13. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/__init__.py +0 -0
  14. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_apify_client.py +0 -0
  15. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_client_registry.py +0 -0
  16. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_consts.py +0 -0
  17. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_docs.py +0 -0
  18. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_literals.py +0 -0
  19. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_logging.py +0 -0
  20. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_models.py +0 -0
  21. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_pagination.py +0 -0
  22. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/__init__.py +0 -0
  23. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/_resource_client.py +0 -0
  24. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/actor_env_var.py +0 -0
  25. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/actor_env_var_collection.py +0 -0
  26. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/actor_version.py +0 -0
  27. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/actor_version_collection.py +0 -0
  28. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/build.py +0 -0
  29. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/build_collection.py +0 -0
  30. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/dataset.py +0 -0
  31. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/dataset_collection.py +0 -0
  32. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/key_value_store.py +0 -0
  33. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/key_value_store_collection.py +0 -0
  34. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/log.py +0 -0
  35. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/request_queue.py +0 -0
  36. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/request_queue_collection.py +0 -0
  37. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/run.py +0 -0
  38. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/run_collection.py +0 -0
  39. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/schedule.py +0 -0
  40. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/schedule_collection.py +0 -0
  41. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/store_collection.py +0 -0
  42. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/task.py +0 -0
  43. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/task_collection.py +0 -0
  44. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/user.py +0 -0
  45. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/webhook.py +0 -0
  46. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/webhook_collection.py +0 -0
  47. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/webhook_dispatch.py +0 -0
  48. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_resource_clients/webhook_dispatch_collection.py +0 -0
  49. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_statistics.py +0 -0
  50. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_status_message_watcher.py +0 -0
  51. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_streamed_log.py +0 -0
  52. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_typeddicts.py +0 -0
  53. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_utils/__init__.py +0 -0
  54. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_utils/crypto.py +0 -0
  55. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_utils/encoding.py +0 -0
  56. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_utils/errors.py +0 -0
  57. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_utils/time.py +0 -0
  58. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_utils/try_import.py +0 -0
  59. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/_utils/wait_for_resources.py +0 -0
  60. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/http_clients/__init__.py +0 -0
  61. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/http_clients/_httpx2.py +0 -0
  62. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/http_clients/_impit.py +0 -0
  63. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/http_clients/_streamed_body.py +0 -0
  64. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/http_compressors/__init__.py +0 -0
  65. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/http_compressors/_base.py +0 -0
  66. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/http_compressors/_brotli.py +0 -0
  67. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/http_compressors/_gzip.py +0 -0
  68. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/http_compressors/_resolve.py +0 -0
  69. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/py.typed +0 -0
  70. {apify_client-3.2.2b9 → apify_client-3.2.2b11}/src/apify_client/types.py +0 -0
@@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file.
13
13
  - Add max_total_charge_usd to task start() and call() ([#1097](https://github.com/apify/apify-client-python/pull/1097)) ([966d3d6](https://github.com/apify/apify-client-python/commit/966d3d687d8d45737bf706fb13de379e682897d5)) by [@vdusek](https://github.com/vdusek), closes [#1096](https://github.com/apify/apify-client-python/issues/1096)
14
14
  - Add missing Standby fields to Actor update and create ([#1107](https://github.com/apify/apify-client-python/pull/1107)) ([8dd5b67](https://github.com/apify/apify-client-python/commit/8dd5b678d1440143f47dc57e29d6a2ef251d041d)) by [@vdusek](https://github.com/vdusek), closes [#1101](https://github.com/apify/apify-client-python/issues/1101)
15
15
  - Add flatten to dataset stream_items ([#1106](https://github.com/apify/apify-client-python/pull/1106)) ([1d1e9f6](https://github.com/apify/apify-client-python/commit/1d1e9f65e6fb6bf752f5dd552b9a2424c73f52fe)) by [@vdusek](https://github.com/vdusek), closes [#1100](https://github.com/apify/apify-client-python/issues/1100)
16
+ - Add default_run_force_permission_level to Actor update and create ([#1111](https://github.com/apify/apify-client-python/pull/1111)) ([dc30b12](https://github.com/apify/apify-client-python/commit/dc30b12f0f3b011619647f19ea2d423cc11145bd)) by [@vdusek](https://github.com/vdusek)
16
17
 
17
18
  ### 🐛 Bug Fixes
18
19
 
@@ -20,6 +21,7 @@ All notable changes to this project will be documented in this file.
20
21
  - Rename `build_tag` to `build` in `validate_input()` ([#1110](https://github.com/apify/apify-client-python/pull/1110)) ([0616e1a](https://github.com/apify/apify-client-python/commit/0616e1a0a5354f609eb5759f3729f6795a3192c4)) by [@vdusek](https://github.com/vdusek), closes [#1091](https://github.com/apify/apify-client-python/issues/1091)
21
22
  - Type `example_run_input_body` as `str` ([#1105](https://github.com/apify/apify-client-python/pull/1105)) ([a1047fa](https://github.com/apify/apify-client-python/commit/a1047faee0c1065844b9639a47cb02422f9302ff)) by [@vdusek](https://github.com/vdusek), closes [#1102](https://github.com/apify/apify-client-python/issues/1102)
22
23
  - Align model names with the renamed OpenAPI schemas ([#1098](https://github.com/apify/apify-client-python/pull/1098)) ([eeabbba](https://github.com/apify/apify-client-python/commit/eeabbba0d02b1ac810b7922e8670261a122ea741)) by [@vdusek](https://github.com/vdusek)
24
+ - Raise InvalidResponseBodyError for every unparsable response body ([#1109](https://github.com/apify/apify-client-python/pull/1109)) ([c8f8ea2](https://github.com/apify/apify-client-python/commit/c8f8ea253c43ea0dbcb8e54c0f01698f2c5e0a0c)) by [@vdusek](https://github.com/vdusek), closes [#1094](https://github.com/apify/apify-client-python/issues/1094)
23
25
 
24
26
  ### ⚡ Performance
25
27
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apify_client
3
- Version: 3.2.2b9
3
+ Version: 3.2.2b11
4
4
  Summary: Apify API client for Python
5
5
  Keywords: apify,api,client,automation,crawling,scraping
6
6
  Author: Apify Technologies s.r.o.
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "apify_client"
7
- version = "3.2.2b9"
7
+ version = "3.2.2b11"
8
8
  description = "Apify API client for Python"
9
9
  license = "Apache-2.0"
10
10
  license-files = ["LICENSE"]
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "apify_client"
7
- version = "3.2.2b9"
7
+ version = "3.2.2b11"
8
8
  description = "Apify API client for Python"
9
9
  authors = [{ name = "Apify Technologies s.r.o.", email = "support@apify.com" }]
10
10
  license = "Apache-2.0"
@@ -120,6 +120,7 @@ class ActorClient(ResourceClient):
120
120
  default_run_max_items: int | None = None,
121
121
  default_run_memory_mbytes: int | None = None,
122
122
  default_run_timeout: timedelta | None = None,
123
+ default_run_force_permission_level: ActorPermissionLevel | None = None,
123
124
  example_run_input_body: str | None = None,
124
125
  example_run_input_content_type: str | None = None,
125
126
  actor_standby_is_enabled: bool | None = None,
@@ -156,6 +157,8 @@ class ActorClient(ResourceClient):
156
157
  by runs of this Actor, if the Actor is charged per result.
157
158
  default_run_memory_mbytes: Default amount of memory allocated for the runs of this Actor, in megabytes.
158
159
  default_run_timeout: Default timeout for the runs of this Actor.
160
+ default_run_force_permission_level: Permission level to force on the runs of this Actor, overriding the
161
+ permission level of the Actor.
159
162
  example_run_input_body: Input to be prefilled as default input to new users of this Actor, serialized
160
163
  as a string (e.g. `json.dumps(input)` for a JSON input).
161
164
  example_run_input_content_type: The content type of the example run input.
@@ -199,6 +202,7 @@ class ActorClient(ResourceClient):
199
202
  max_items=default_run_max_items,
200
203
  memory_mbytes=default_run_memory_mbytes,
201
204
  timeout_secs=to_seconds(default_run_timeout, as_int=True),
205
+ force_permission_level=default_run_force_permission_level,
202
206
  restart_on_error=restart_on_error,
203
207
  ),
204
208
  actor_standby=ActorStandby(
@@ -676,6 +680,7 @@ class ActorClientAsync(ResourceClientAsync):
676
680
  default_run_max_items: int | None = None,
677
681
  default_run_memory_mbytes: int | None = None,
678
682
  default_run_timeout: timedelta | None = None,
683
+ default_run_force_permission_level: ActorPermissionLevel | None = None,
679
684
  example_run_input_body: str | None = None,
680
685
  example_run_input_content_type: str | None = None,
681
686
  actor_standby_is_enabled: bool | None = None,
@@ -712,6 +717,8 @@ class ActorClientAsync(ResourceClientAsync):
712
717
  by runs of this Actor, if the Actor is charged per result.
713
718
  default_run_memory_mbytes: Default amount of memory allocated for the runs of this Actor, in megabytes.
714
719
  default_run_timeout: Default timeout for the runs of this Actor.
720
+ default_run_force_permission_level: Permission level to force on the runs of this Actor, overriding the
721
+ permission level of the Actor.
715
722
  example_run_input_body: Input to be prefilled as default input to new users of this Actor, serialized
716
723
  as a string (e.g. `json.dumps(input)` for a JSON input).
717
724
  example_run_input_content_type: The content type of the example run input.
@@ -755,6 +762,7 @@ class ActorClientAsync(ResourceClientAsync):
755
762
  max_items=default_run_max_items,
756
763
  memory_mbytes=default_run_memory_mbytes,
757
764
  timeout_secs=to_seconds(default_run_timeout, as_int=True),
765
+ force_permission_level=default_run_force_permission_level,
758
766
  restart_on_error=restart_on_error,
759
767
  ),
760
768
  actor_standby=ActorStandby(
@@ -21,6 +21,7 @@ if TYPE_CHECKING:
21
21
  from collections.abc import AsyncIterator, Iterator
22
22
  from datetime import timedelta
23
23
 
24
+ from apify_client._literals import ActorPermissionLevel
24
25
  from apify_client._models import ActorListItem
25
26
  from apify_client.types import Timeout
26
27
 
@@ -123,6 +124,7 @@ class ActorCollectionClient(ResourceClient):
123
124
  default_run_max_items: int | None = None,
124
125
  default_run_memory_mbytes: int | None = None,
125
126
  default_run_timeout: timedelta | None = None,
127
+ default_run_force_permission_level: ActorPermissionLevel | None = None,
126
128
  example_run_input_body: str | None = None,
127
129
  example_run_input_content_type: str | None = None,
128
130
  actor_standby_is_enabled: bool | None = None,
@@ -156,6 +158,8 @@ class ActorCollectionClient(ResourceClient):
156
158
  of this Actor, if the Actor is charged per result.
157
159
  default_run_memory_mbytes: Default amount of memory allocated for the runs of this Actor, in megabytes.
158
160
  default_run_timeout: Default timeout for the runs of this Actor.
161
+ default_run_force_permission_level: Permission level to force on the runs of this Actor, overriding the
162
+ permission level of the Actor.
159
163
  example_run_input_body: Input to be prefilled as default input to new users of this Actor, serialized
160
164
  as a string (e.g. `json.dumps(input)` for a JSON input).
161
165
  example_run_input_content_type: The content type of the example run input.
@@ -192,6 +196,7 @@ class ActorCollectionClient(ResourceClient):
192
196
  max_items=default_run_max_items,
193
197
  memory_mbytes=default_run_memory_mbytes,
194
198
  timeout_secs=to_seconds(default_run_timeout, as_int=True),
199
+ force_permission_level=default_run_force_permission_level,
195
200
  restart_on_error=restart_on_error,
196
201
  ),
197
202
  actor_standby=ActorStandby(
@@ -311,6 +316,7 @@ class ActorCollectionClientAsync(ResourceClientAsync):
311
316
  default_run_max_items: int | None = None,
312
317
  default_run_memory_mbytes: int | None = None,
313
318
  default_run_timeout: timedelta | None = None,
319
+ default_run_force_permission_level: ActorPermissionLevel | None = None,
314
320
  example_run_input_body: str | None = None,
315
321
  example_run_input_content_type: str | None = None,
316
322
  actor_standby_is_enabled: bool | None = None,
@@ -344,6 +350,8 @@ class ActorCollectionClientAsync(ResourceClientAsync):
344
350
  of this Actor, if the Actor is charged per result.
345
351
  default_run_memory_mbytes: Default amount of memory allocated for the runs of this Actor, in megabytes.
346
352
  default_run_timeout: Default timeout for the runs of this Actor.
353
+ default_run_force_permission_level: Permission level to force on the runs of this Actor, overriding the
354
+ permission level of the Actor.
347
355
  example_run_input_body: Input to be prefilled as default input to new users of this Actor, serialized
348
356
  as a string (e.g. `json.dumps(input)` for a JSON input).
349
357
  example_run_input_content_type: The content type of the example run input.
@@ -380,6 +388,7 @@ class ActorCollectionClientAsync(ResourceClientAsync):
380
388
  max_items=default_run_max_items,
381
389
  memory_mbytes=default_run_memory_mbytes,
382
390
  timeout_secs=to_seconds(default_run_timeout, as_int=True),
391
+ force_permission_level=default_run_force_permission_level,
383
392
  restart_on_error=restart_on_error,
384
393
  ),
385
394
  actor_standby=ActorStandby(
@@ -1,7 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import warnings
4
- from typing import TYPE_CHECKING
4
+ from typing import TYPE_CHECKING, Any
5
5
  from urllib.parse import quote
6
6
 
7
7
  from apify_client._consts import (
@@ -11,6 +11,7 @@ from apify_client._consts import (
11
11
  COMPRESSIBLE_MEDIA_TYPES,
12
12
  OVERRIDABLE_DEFAULT_HEADERS,
13
13
  )
14
+ from apify_client.errors import InvalidResponseBodyError
14
15
 
15
16
  if TYPE_CHECKING:
16
17
  from apify_client.http_clients import HttpResponse
@@ -80,6 +81,18 @@ def is_compressible_content_type(content_type: str | None) -> bool:
80
81
  )
81
82
 
82
83
 
84
+ def _parse_json(response: HttpResponse) -> Any:
85
+ """Parse the response body as JSON.
86
+
87
+ Raises:
88
+ InvalidResponseBodyError: If the response body is not valid JSON.
89
+ """
90
+ try:
91
+ return response.json()
92
+ except ValueError as err:
93
+ raise InvalidResponseBodyError(response) from err
94
+
95
+
83
96
  def response_to_dict(response: HttpResponse) -> dict:
84
97
  """Parse the API response as a dictionary and validate its type.
85
98
 
@@ -90,9 +103,10 @@ def response_to_dict(response: HttpResponse) -> dict:
90
103
  The parsed response as a dictionary.
91
104
 
92
105
  Raises:
106
+ InvalidResponseBodyError: If the response body is not valid JSON.
93
107
  ValueError: If the response is not a dictionary.
94
108
  """
95
- data = response.json()
109
+ data = _parse_json(response)
96
110
 
97
111
  if isinstance(data, dict):
98
112
  return data
@@ -110,9 +124,10 @@ def response_to_list(response: HttpResponse) -> list:
110
124
  The parsed response as a list.
111
125
 
112
126
  Raises:
127
+ InvalidResponseBodyError: If the response body is not valid JSON.
113
128
  ValueError: If the response is not a list.
114
129
  """
115
- data = response.json()
130
+ data = _parse_json(response)
116
131
 
117
132
  if isinstance(data, list):
118
133
  return data
@@ -134,12 +134,13 @@ class ServerError(ApifyApiError):
134
134
 
135
135
 
136
136
  @docs_group('Errors')
137
- class InvalidResponseBodyError(ApifyClientError):
137
+ class InvalidResponseBodyError(ApifyClientError, ValueError):
138
138
  """Error raised when a response body cannot be parsed.
139
139
 
140
140
  This occurs when the API returns a body that does not match its content type, for example a malformed JSON
141
141
  document. It is raised on a response the client already accepted, so it is not retried - a transfer that breaks
142
- mid-body surfaces as a transport error inside the retry loop instead.
142
+ mid-body surfaces as a transport error inside the retry loop instead. It subclasses `ValueError`, the error a
143
+ failed JSON decode raises, so an `except ValueError` handler catches it too.
143
144
  """
144
145
 
145
146
  def __init__(self, response: HttpResponse) -> None:
@@ -78,7 +78,11 @@ class HttpResponse(Protocol):
78
78
  """Response headers as a mapping."""
79
79
 
80
80
  def json(self) -> Any:
81
- """Parse response body as JSON."""
81
+ """Parse response body as JSON.
82
+
83
+ Raises:
84
+ ValueError: If the body is not valid JSON.
85
+ """
82
86
 
83
87
  def read(self) -> bytes:
84
88
  """Read the entire response body."""
File without changes