UserRestriction

toloka.client.user_restriction.UserRestriction | Source code

UserRestriction(
self,
*,
user_id: Optional[str] = None,
private_comment: Optional[str] = None,
will_expire: Optional[datetime] = None,
id: Optional[str] = None,
created: Optional[datetime] = None
)

Controls access to projects and pools.

You can restrict access to any project for a Toloker. Then he can't do tasks in the project. You may set the duration of restriction or apply permanent restriction. To unlock access pass the restriction ID to the delete_user_restriction.

Parameters Description

ParametersTypeDescription
user_idOptional[str]

The ID of the Toloker.

private_commentOptional[str]

A comment for you why access to this Toloker was restricted.

will_expireOptional[datetime]

When access is restored. If you do not set the parameter, then the access restriction is permanent.

idOptional[str]

The identifier of a specific fact of access restriction. Read-only field.

createdOptional[datetime]

Date and time when the fact of access restriction was created. Read-only field.

Examples:

How you can lock access for one Toloker on one project.

new_restrict = toloka_client.set_user_restriction(
ProjectUserRestriction(
user_id='1',
private_comment='I dont like you',
project_id='5'
)
)

And how you can unlock it.

toloka_client.delete_user_restriction(new_restrict.id)
Toloka-Kit
OverviewGetting OAuth tokenQuick start
Recipes
Reference
toloka.client
toloka.async_client
toloka.autoquality [autoquality]
toloka.metrics
toloka.streaming