Toloka documentation

MessageThreadCursor

toloka.streaming.cursor.MessageThreadCursor | Source code

MessageThreadCursor(
    self,
    toloka_client: Union[TolokaClient, AsyncTolokaClient],
    folder: Union[str, Folder, List[Union[str, Folder]], None] = None,
    folder_ne: Union[str, Folder, List[Union[str, Folder]], None] = None,
    id_lt: Optional[str] = None,
    id_lte: Optional[str] = None,
    id_gt: Optional[str] = None,
    id_gte: Optional[str] = None,
    created_lt: Optional[datetime] = None,
    created_lte: Optional[datetime] = None,
    created_gt: Optional[datetime] = None,
    created_gte: Optional[datetime] = None
)

Iterator over messages by create time.

Parameters Description

Parameters Type Description
toloka_client Union[TolokaClient, AsyncTolokaClient]

TolokaClient object that is being used to search messages.

request MessageThreadSearchRequest

Base request to search messages.

Examples:

Iterate over all messages.

it = MessageThreadCursor(toloka_client=toloka_client)
all_messages = list(it)
new_messages = list(it)  # Contains only new messages, appeared since the previous call.