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)
A base class for access restrictions.
Toloker's access to projects or pools can be restricted. You can set the duration of the ban or apply an unlimited restriction.
Use the set_user_restriction method to apply a restriction and the delete_user_restriction method to remove it.
Parameters | Type | Description |
---|---|---|
id | Optional[str] | The ID of the restriction. |
user_id | Optional[str] | The ID of the Toloker. |
private_comment | Optional[str] | A comment visible to the requester only. |
will_expire | Optional[datetime] | The UTC date and time when the access will be restored by Toloka. If the parameter isn't set, then the restriction is active until you remove it calling the |
created | Optional[datetime] | The UTC date and time when the restriction was applied. Read-only field. |
Examples:
Restricting access to a project and removing the restriction.
new_restriction = toloka_client.set_user_restriction( toloka.client.user_restriction.ProjectUserRestriction( user_id='1ad097faba0eff85a04fe30bc04d53db', private_comment='Low response quality', project_id='5' ))toloka_client.delete_user_restriction(new_restriction.id)
Last updated: August 28, 2023