create_user_bonuses_async

toloka.client.TolokaClient.create_user_bonuses_async | Source code

Issues bonus payments to Tolokers asynchronously.

You can send a maximum of 10,000 requests of this kind per day.

Parameters description

ParametersTypeDescription
user_bonusesList[UserBonus]

A list of bonuses.

operation_idOptional[UUID]

The UUID of the operation that conforms to the RFC4122 standard. The UUID is used if async_mode is True.

Specify UUID to avoid accidental errors like Toloka operation duplication caused by network problems. If you send several requests with the same operation_id, Toloka performs the operation only once.

async_modeOptional[bool]

Request processing mode:

  • True — Asynchronous operation is started internally.
  • False — The request is processed synchronously.

Default value: True.

skip_invalid_itemsOptional[bool]

Bonus validation option:

  • True — All valid bonuses are issued. If a bonus doesn't pass validation, then it isn't issued to a Toloker. All such bonuses are listed in the response.
  • False — If any bonus doesn't pass validation, then the operation is cancelled and no bonuses are issued to Tolokers.

Default value: False.

Examples:

from decimal import Decimal
new_bonuses=[
toloka.client.UserBonus(
user_id='fac97860c7929add8048ed2ef63b66fd',
amount=Decimal('1.00'),
public_title={'EN': 'Perfect job!'},
public_message={'EN': 'You are the best!'},
assignment_id='00001092da--61ef030400c684132d0da0de'
),
toloka.client.UserBonus(
user_id='a1b0b42923c429daa2c764d7ccfc364d',
amount=Decimal('0.80'),
public_title={'EN': 'Excellent work!'},
public_message={'EN': 'You have completed all tasks!'},
assignment_id='000015fccc--63bfc4c358d7a46c32a7b233'
)
]
bonus_op = toloka_client.create_user_bonuses_async(new_bonuses)
toloka_client.wait_operation(bonus_op)

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