The page https://docs.apify.com/platform/actors/development/actor-definition/dataset-schema/validation contains the following example:
from apify import Actor
from apify_client.errors import ApifyApiError
async with Actor:
try:
await Actor.push_data(items)
except ApifyApiError as error:
if 'invalidItems' in error.data:
validation_errors = error.data['invalidItems']
@buhrmann wrote the following comment where they point out shortcomings of the example:
Hi, the Python example isn't very helpful. It has errors (e.data references a variable that doesn't exist, it should be error.data), and it doesn't show where ApifyApiError comes from. In fact, the error class isn't even part of the public API, it has to be imported from the internal apify_client._errors package. The SDK reference equally only mentions that the error class exists, but doesn't indicate in which package to find it.
Can the Python SDK team, please, verify, that this is how the validation should be done? I can update the page and the surrounding text, but my knowledge of the SDK is limited, so I'd welcome some guidance from those who have an idea about the canonical way to do this 👀 @vdusek @fnesveda @janbuchar @Pijukatel
The page https://docs.apify.com/platform/actors/development/actor-definition/dataset-schema/validation contains the following example:
@buhrmann wrote the following comment where they point out shortcomings of the example:
Can the Python SDK team, please, verify, that this is how the validation should be done? I can update the page and the surrounding text, but my knowledge of the SDK is limited, so I'd welcome some guidance from those who have an idea about the canonical way to do this 👀 @vdusek @fnesveda @janbuchar @Pijukatel