Skip to main content

UsersClient

Client for managing users in the Datagrok platform. Provides methods to retrieve, update, list, block, and unblock users, as well as to get information about the current authenticated user.

Examples

Get user by login

>>> from datagrok_api import DatagrokClient
>>> from datagrok_api.models import Func, Script, ScriptLanguage, DataQuery
>>> grok = DatagrokClient(base_url="https://public.datagrok.ai/api", api_key="Bearer <your-token>")
>>> john_doe = grok.users.get("johndoe")
>>> print(john_doe.first_name)
... John

Get current authenticated user

>>> me = grok.users.current()

Methods

__init__()

get()

Get detailed information about a specific user.

Parameters

NameTypeDescription
idstrID or login of the user to retrieve

Returns

TypeDescription
UserUser instance with detailed information

save()

Save or update User.

Parameters

NameTypeDescription
userUserThe user to save or update

Returns

TypeDescription
UserThe saved user instance

current()

Returns the current authenticated user.

Returns

TypeDescription
UserUser instance representing the current user

list()

List users from Datagrok with optional filtering and inclusion of related data.

Parameters

NameTypeDescription
smart_filterOptional[str]Optional smart search filter to apply
include_groupboolWhether to include personal group in the results

Returns

TypeDescription
List[User]List of User instances matching the criteria

block()

Block a user from accessing the Datagrok platform.

Parameters

NameTypeDescription
userUserThe user to block.

unblock()

Unblock a previously blocked user.

Parameters

NameTypeDescription
userUserThe user to unblock.