Skip to content

The dataset validation example for Python seems to be outdated #2004

@honzajavorek

Description

@honzajavorek

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    pythonPull requests that update Python codet-academyIssues related to Web Scraping and Apify academies.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions