find_attachments
toloka.client.TolokaClient.find_attachments
Finds all attachments that match certain rules
As a result, it returns an object that contains the first part of the found attachments and whether there are any more results. It is better to use the "get_attachments" method, they allow to iterate trought all results and not just the first output.
Parameters Description
Parameters | Type | Description |
---|---|---|
name |
Optional[str] | File name. |
type |
Optional[Attachment.Type] | Attachment type. Currently the key can have only one value - ASSIGNMENT_ATTACHMENT. |
user_id |
Optional[str] | ID of the user who uploaded the file(s). |
assignment_id |
Optional[str] | Assignment ID. |
pool_id |
Optional[str] | Pool ID. |
owner_id |
Optional[str] | Optional[str] |
owner_company_id |
Optional[str] | Optional[str] |
id_lt |
Optional[str] | Files with an ID less than the specified value. |
id_lte |
Optional[str] | Files with an ID less than or equal to the specified value. |
id_gt |
Optional[str] | Files with an ID greater than the specified value. |
id_gte |
Optional[str] | Files with an ID greater than or equal to the specified value. |
created_lt |
Optional[datetime] | Files uploaded by users before the specified date. |
created_lte |
Optional[datetime] | Files uploaded by users before or on the specified date. |
created_gt |
Optional[datetime] | Files uploaded by users after the specified date. |
created_gte |
Optional[datetime] | Files uploaded by users after or on the specified date. |
sort |
Union[List[str], AttachmentSortItems, None] | How to sort result. Defaults to None. |
limit |
Optional[int] | Limit on the number of results returned. The maximum is 100,000. Defaults to None, in which case it returns first 50 results. |
-
Returns:
The first
limit
assignments initems
. And a mark that there is more. -
Return type:
Examples:
Let's find attachments in the pool and sort them by id and date of creation.
toloka_client.find_attachments(pool_id='1', sort=['-created', '-id'], limit=10)
If method finds more objects than custom or system limit
allows to operate, it will also show an indicator has_more=True
.