Skip to content

Commit a1047fa

Browse files
authored
fix: type example_run_input_body as str (#1105)
`ExampleRunInput.body` only accepts a string, but `actor.update()` and `actors().create()` typed `example_run_input_body` as `Any`. A dict passed the type checker and then failed with a pydantic `ValidationError`. The parameter is now `str | None` in the sync and async clients, the same as `body: string` in the JS client, and the docstring says to pass a serialized string such as `json.dumps(input)`. Closes: #1102 *✍️ Drafted by Claude Code*
1 parent 0616e1a commit a1047fa

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

‎src/apify_client/_resource_clients/actor.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def update(
120120
default_run_max_items: int | None = None,
121121
default_run_memory_mbytes: int | None = None,
122122
default_run_timeout: timedelta | None = None,
123-
example_run_input_body: Any = None,
123+
example_run_input_body: str | None = None,
124124
example_run_input_content_type: str | None = None,
125125
actor_standby_is_enabled: bool | None = None,
126126
actor_standby_desired_requests_per_actor_run: int | None = None,
@@ -156,7 +156,8 @@ def update(
156156
by runs of this Actor, if the Actor is charged per result.
157157
default_run_memory_mbytes: Default amount of memory allocated for the runs of this Actor, in megabytes.
158158
default_run_timeout: Default timeout for the runs of this Actor.
159-
example_run_input_body: Input to be prefilled as default input to new users of this Actor.
159+
example_run_input_body: Input to be prefilled as default input to new users of this Actor, serialized
160+
as a string (e.g. `json.dumps(input)` for a JSON input).
160161
example_run_input_content_type: The content type of the example run input.
161162
actor_standby_is_enabled: Whether the Actor Standby is enabled.
162163
actor_standby_desired_requests_per_actor_run: The desired number of concurrent HTTP requests for
@@ -675,7 +676,7 @@ async def update(
675676
default_run_max_items: int | None = None,
676677
default_run_memory_mbytes: int | None = None,
677678
default_run_timeout: timedelta | None = None,
678-
example_run_input_body: Any = None,
679+
example_run_input_body: str | None = None,
679680
example_run_input_content_type: str | None = None,
680681
actor_standby_is_enabled: bool | None = None,
681682
actor_standby_desired_requests_per_actor_run: int | None = None,
@@ -711,7 +712,8 @@ async def update(
711712
by runs of this Actor, if the Actor is charged per result.
712713
default_run_memory_mbytes: Default amount of memory allocated for the runs of this Actor, in megabytes.
713714
default_run_timeout: Default timeout for the runs of this Actor.
714-
example_run_input_body: Input to be prefilled as default input to new users of this Actor.
715+
example_run_input_body: Input to be prefilled as default input to new users of this Actor, serialized
716+
as a string (e.g. `json.dumps(input)` for a JSON input).
715717
example_run_input_content_type: The content type of the example run input.
716718
actor_standby_is_enabled: Whether the Actor Standby is enabled.
717719
actor_standby_desired_requests_per_actor_run: The desired number of concurrent HTTP requests for

‎src/apify_client/_resource_clients/actor_collection.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def create(
123123
default_run_max_items: int | None = None,
124124
default_run_memory_mbytes: int | None = None,
125125
default_run_timeout: timedelta | None = None,
126-
example_run_input_body: Any = None,
126+
example_run_input_body: str | None = None,
127127
example_run_input_content_type: str | None = None,
128128
actor_standby_is_enabled: bool | None = None,
129129
actor_standby_desired_requests_per_actor_run: int | None = None,
@@ -156,7 +156,8 @@ def create(
156156
of this Actor, if the Actor is charged per result.
157157
default_run_memory_mbytes: Default amount of memory allocated for the runs of this Actor, in megabytes.
158158
default_run_timeout: Default timeout for the runs of this Actor.
159-
example_run_input_body: Input to be prefilled as default input to new users of this Actor.
159+
example_run_input_body: Input to be prefilled as default input to new users of this Actor, serialized
160+
as a string (e.g. `json.dumps(input)` for a JSON input).
160161
example_run_input_content_type: The content type of the example run input.
161162
actor_standby_is_enabled: Whether the Actor Standby is enabled.
162163
actor_standby_desired_requests_per_actor_run: The desired number of concurrent HTTP requests for
@@ -310,7 +311,7 @@ async def create(
310311
default_run_max_items: int | None = None,
311312
default_run_memory_mbytes: int | None = None,
312313
default_run_timeout: timedelta | None = None,
313-
example_run_input_body: Any = None,
314+
example_run_input_body: str | None = None,
314315
example_run_input_content_type: str | None = None,
315316
actor_standby_is_enabled: bool | None = None,
316317
actor_standby_desired_requests_per_actor_run: int | None = None,
@@ -343,7 +344,8 @@ async def create(
343344
of this Actor, if the Actor is charged per result.
344345
default_run_memory_mbytes: Default amount of memory allocated for the runs of this Actor, in megabytes.
345346
default_run_timeout: Default timeout for the runs of this Actor.
346-
example_run_input_body: Input to be prefilled as default input to new users of this Actor.
347+
example_run_input_body: Input to be prefilled as default input to new users of this Actor, serialized
348+
as a string (e.g. `json.dumps(input)` for a JSON input).
347349
example_run_input_content_type: The content type of the example run input.
348350
actor_standby_is_enabled: Whether the Actor Standby is enabled.
349351
actor_standby_desired_requests_per_actor_run: The desired number of concurrent HTTP requests for

0 commit comments

Comments
 (0)