Skip to content

Commit 986e611

Browse files
authored
docs: Fix dataset validation python code example (#1966)
based on the #1963 (comment)
1 parent 8f31578 commit 986e611

File tree

1 file changed

+9
-6
lines changed
  • sources/platform/actors/development/actor_definition/dataset_schema

1 file changed

+9
-6
lines changed

sources/platform/actors/development/actor_definition/dataset_schema/validation.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,15 @@ try {
123123
</TabItem>
124124
<TabItem value="Python" label="Python">
125125
```python
126-
try:
127-
await Actor.push_data(items)
128-
except ApifyApiError as error:
129-
if "invalidItems" in error.data:
130-
validation_errors = e.data["invalidItems"]
126+
from apify import Actor
127+
from apify_client.errors import ApifyApiError
128+
129+
async with Actor:
130+
try:
131+
await Actor.push_data(items)
132+
except ApifyApiError as error:
133+
if 'invalidItems' in error.data:
134+
validation_errors = error.data['invalidItems']
131135
```
132136
</TabItem>
133137
</Tabs>
@@ -235,4 +239,3 @@ When you configure the dataset fields schema, we generate a field list and measu
235239
236240
237241
You can use them in [monitoring](../../../../monitoring#alert-configuration).
238-

0 commit comments

Comments
 (0)