apify / apify-client-python

Apify API client for Python
https://docs.apify.com/api/client/python/
Apache License 2.0
47 stars 12 forks source link

`ApifyApiError` raised when passing list of strings in `.get_items_as_bytes()` #171

Closed p1utoze closed 10 months ago

p1utoze commented 10 months ago

While exporting a filtered dataset with specific fields as a list of strings after running the apify/website-content-crawler actor, I encountered an ApifyApiError

Here's the code snippet:

apify_client = ApifyClient()
actor_client = apify_client.actor('apify/website-content-crawler')
last_succeeded_run_client = actor_client.last_run(status='SUCCEEDED')
last_succeeded_run_client.dataset().get_items_as_bytes(item_format='json', fields=["url", "text", "markdown"])

This raises the following error:

ApifyApiError: Expected `fields` to be of type `string` but received type `Array`

Despite the type hinting in the method signature suggesting list[str] for the fields parameter, the actual implementation seems to be expecting a single string instead.

Is this a bug in the apify/website-content-crawler actor or am I doing something wrong? What is the intended behavior of the fields parameter and how can I fix this error while exporting the filtered data with a list of desired fields?

vdusek commented 10 months ago

Hi @p1utoze, thank you for reporting this issue. I've been able to successfully replicate the problem. We will try to address it as soon as possible.

vdusek commented 10 months ago

@p1utoze A version 1.6.1 was released fixing this bug. Thank you.