toloka.client.TolokaClient.find_attachments
| Source code
Finds attachments that match certain criteria and returns their metadata.
The number of returned attachments is limited. To find remaining attachments call find_attachments
with updated search criteria.
To iterate over all matching attachments you may use the get_attachments method.
Parameters | Type | Description |
---|---|---|
name | Optional[str] | An attachment file name. |
type | Optional[Attachment.Type] | An attachment type. Refer to the Attachment.Type page for more information on the available |
user_id | Optional[str] | The ID of a Toloker who uploaded attachments. |
assignment_id | Optional[str] | The ID of an assignment with attachments. Either |
pool_id | Optional[str] | The ID of a pool with attachments. Either |
id_lt | Optional[str] | Attachments with IDs less than the specified value. |
id_lte | Optional[str] | Attachments with IDs less than or equal to the specified value. |
id_gt | Optional[str] | Attachments with IDs greater than the specified value. |
id_gte | Optional[str] | Attachments with IDs greater than or equal to the specified value. |
created_lt | Optional[datetime] | Attachments uploaded by Tolokers before the specified date. |
created_lte | Optional[datetime] | Attachments uploaded by Tolokers before or on the specified date. |
created_gt | Optional[datetime] | Attachments uploaded by Tolokers after the specified date. |
created_gte | Optional[datetime] | Attachments uploaded by Tolokers after or on the specified date. |
sort | Union[List[str], AttachmentSortItems, None] | Sorting options. Default: |
limit | Optional[int] | Returned attachments limit. The maximum allowed value: 100. |
Returns:
Found attachments and a flag showing whether there are more matching attachments exceeding the limit.
Return type:
Examples:
Let's find attachments in the pool and sort them by the ID and the date of creation in the descending order.
attachments = toloka_client.find_attachments(pool_id='1080020', sort=['-created', '-id'], limit=10)
If there are attachments exceeding the limit
, then attachments.has_more
is set to True
.
Last updated: August 28, 2023