get_attachments

toloka.client.TolokaClient.get_attachments | Source code

Finds all attachments that match certain criteria and returns their metadata.

get_attachments returns a generator. You can iterate over all found attachments using the generator. Several requests to the Toloka server are possible while iterating.

If you need to sort attachments use the find_attachments method.

Parameters description

ParametersTypeDescription
nameOptional[str]

An attachment file name.

typeOptional[Attachment.Type]

An attachment type. Refer to the Attachment.Type page for more information on the available type values.

user_idOptional[str]

The ID of a Toloker who uploaded attachments.

assignment_idOptional[str]

The ID of an assignment with attachments. Either assignment_id of pool_id is required in a search request.

pool_idOptional[str]

The ID of a pool with attachments. Either assignment_id of pool_id is required in a search request.

id_ltOptional[str]

Attachments with IDs less than the specified value.

id_lteOptional[str]

Attachments with IDs less than or equal to the specified value.

id_gtOptional[str]

Attachments with IDs greater than the specified value.

id_gteOptional[str]

Attachments with IDs greater than or equal to the specified value.

created_ltOptional[datetime]

Attachments uploaded by Tolokers before the specified date.

created_lteOptional[datetime]

Attachments uploaded by Tolokers before or on the specified date.

created_gtOptional[datetime]

Attachments uploaded by Tolokers after the specified date.

created_gteOptional[datetime]

Attachments uploaded by Tolokers after or on the specified date.

batch_sizeOptional[int]

A limit of items returned by each request to Toloka. The maximum allowed value: 100.

  • Yields:

    The next matching attachment.

  • Yield type:

    Generator[Attachment, None, None]

Examples:

Making a list of all received attachments in a pool.

attachments = list(toloka_client.get_attachments(pool_id='1080020'))

Last updated: August 28, 2023

Toloka-Kit
OverviewGetting API keyQuick start
Recipes
Reference
toloka.client
toloka.async_client
toloka.autoquality [autoquality]
toloka.metrics
toloka.streaming