Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/apify_client/clients/resource_clients/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def list_items(
skip_hidden: bool | None = None,
flatten: list[str] | None = None,
view: str | None = None,
signature: str | None = None,
) -> ListPage:
"""List the items of the dataset.

Expand Down Expand Up @@ -116,6 +117,7 @@ def list_items(
the # character.
flatten: A list of fields that should be flattened.
view: Name of the dataset view to be used.
signature: Signature used to access the items.

Returns:
A page of the list of dataset items according to the specified filters.
Expand All @@ -132,6 +134,7 @@ def list_items(
skipHidden=skip_hidden,
flatten=flatten,
view=view,
signature=signature,
)

response = self.http_client.call(
Expand Down Expand Up @@ -169,6 +172,7 @@ def iterate_items(
unwind: list[str] | None = None,
skip_empty: bool | None = None,
skip_hidden: bool | None = None,
signature: str | None = None,
) -> Iterator[dict]:
"""Iterate over the items in the dataset.

Expand Down Expand Up @@ -198,6 +202,7 @@ def iterate_items(
contain less items than the limit value.
skip_hidden: If True, then hidden fields are skipped from the output, i.e. fields starting with
the # character.
signature: Signature used to access the items.

Yields:
An item from the dataset.
Expand Down Expand Up @@ -227,6 +232,7 @@ def iterate_items(
unwind=unwind,
skip_empty=skip_empty,
skip_hidden=skip_hidden,
signature=signature,
)

yield from current_items_page.items
Expand Down Expand Up @@ -256,6 +262,7 @@ def download_items(
xml_root: str | None = None,
xml_row: str | None = None,
flatten: list[str] | None = None,
signature: str | None = None,
) -> bytes:
"""Get the items in the dataset as raw bytes.

Expand Down Expand Up @@ -300,6 +307,7 @@ def download_items(
xml_row: Overrides default element name that wraps each page or page function result object in xml output.
By default the element name is item.
flatten: A list of fields that should be flattened.
signature: Signature used to access the items.

Returns:
The dataset items as raw bytes.
Expand Down Expand Up @@ -327,6 +335,7 @@ def download_items(
xml_root=xml_root,
xml_row=xml_row,
flatten=flatten,
signature=signature,
)

def get_items_as_bytes(
Expand All @@ -348,6 +357,7 @@ def get_items_as_bytes(
xml_root: str | None = None,
xml_row: str | None = None,
flatten: list[str] | None = None,
signature: str | None = None,
) -> bytes:
"""Get the items in the dataset as raw bytes.

Expand Down Expand Up @@ -390,6 +400,7 @@ def get_items_as_bytes(
xml_row: Overrides default element name that wraps each page or page function result object in xml output.
By default the element name is item.
flatten: A list of fields that should be flattened.
signature: Signature used to access the items.

Returns:
The dataset items as raw bytes.
Expand All @@ -411,6 +422,7 @@ def get_items_as_bytes(
xmlRoot=xml_root,
xmlRow=xml_row,
flatten=flatten,
signature=signature,
)

response = self.http_client.call(
Expand Down Expand Up @@ -440,6 +452,7 @@ def stream_items(
skip_hidden: bool | None = None,
xml_root: str | None = None,
xml_row: str | None = None,
signature: str | None = None,
) -> Iterator[impit.Response]:
"""Retrieve the items in the dataset as a stream.

Expand Down Expand Up @@ -481,6 +494,7 @@ def stream_items(
xml_root: Overrides default root element name of xml output. By default the root element is items.
xml_row: Overrides default element name that wraps each page or page function result object in xml output.
By default the element name is item.
signature: Signature used to access the items.

Returns:
The dataset items as a context-managed streaming `Response`.
Expand All @@ -503,6 +517,7 @@ def stream_items(
skipHidden=skip_hidden,
xmlRoot=xml_root,
xmlRow=xml_row,
signature=signature,
)

response = self.http_client.call(
Expand Down Expand Up @@ -683,6 +698,7 @@ async def list_items(
skip_hidden: bool | None = None,
flatten: list[str] | None = None,
view: str | None = None,
signature: str | None = None,
) -> ListPage:
"""List the items of the dataset.

Expand Down Expand Up @@ -714,6 +730,7 @@ async def list_items(
the # character.
flatten: A list of fields that should be flattened.
view: Name of the dataset view to be used.
signature: Signature used to access the items.

Returns:
A page of the list of dataset items according to the specified filters.
Expand All @@ -730,6 +747,7 @@ async def list_items(
skipHidden=skip_hidden,
flatten=flatten,
view=view,
signature=signature,
)

response = await self.http_client.call(
Expand Down Expand Up @@ -767,6 +785,7 @@ async def iterate_items(
unwind: list[str] | None = None,
skip_empty: bool | None = None,
skip_hidden: bool | None = None,
signature: str | None = None,
) -> AsyncIterator[dict]:
"""Iterate over the items in the dataset.

Expand Down Expand Up @@ -796,6 +815,7 @@ async def iterate_items(
contain less items than the limit value.
skip_hidden: If True, then hidden fields are skipped from the output, i.e. fields starting with
the # character.
signature: Signature used to access the items.

Yields:
An item from the dataset.
Expand Down Expand Up @@ -825,6 +845,7 @@ async def iterate_items(
unwind=unwind,
skip_empty=skip_empty,
skip_hidden=skip_hidden,
signature=signature,
)

for item in current_items_page.items:
Expand Down Expand Up @@ -855,6 +876,7 @@ async def get_items_as_bytes(
xml_root: str | None = None,
xml_row: str | None = None,
flatten: list[str] | None = None,
signature: str | None = None,
) -> bytes:
"""Get the items in the dataset as raw bytes.

Expand Down Expand Up @@ -897,6 +919,7 @@ async def get_items_as_bytes(
xml_row: Overrides default element name that wraps each page or page function result object in xml output.
By default the element name is item.
flatten: A list of fields that should be flattened.
signature: Signature used to access the items.

Returns:
The dataset items as raw bytes.
Expand All @@ -918,6 +941,7 @@ async def get_items_as_bytes(
xmlRoot=xml_root,
xmlRow=xml_row,
flatten=flatten,
signature=signature,
)

response = await self.http_client.call(
Expand Down Expand Up @@ -947,6 +971,7 @@ async def stream_items(
skip_hidden: bool | None = None,
xml_root: str | None = None,
xml_row: str | None = None,
signature: str | None = None,
) -> AsyncIterator[impit.Response]:
"""Retrieve the items in the dataset as a stream.

Expand Down Expand Up @@ -988,6 +1013,7 @@ async def stream_items(
xml_root: Overrides default root element name of xml output. By default the root element is items.
xml_row: Overrides default element name that wraps each page or page function result object in xml output.
By default the element name is item.
signature: Signature used to access the items.

Returns:
The dataset items as a context-managed streaming `Response`.
Expand All @@ -1010,6 +1036,7 @@ async def stream_items(
skipHidden=skip_hidden,
xmlRoot=xml_root,
xmlRow=xml_row,
signature=signature,
)

response = await self.http_client.call(
Expand Down
Loading