Skip to content

Authentication

from qdl import create_token, list_tokens, remove_token, set_token, me

create_token

Create an API token with the given name for the current logged-in user.

Parameters:

Name Type Description Default
name NonEmptyString256

Name for the token.

required

Returns:

Type Description
str

Token value.

Raises:

Type Description
QdlSdkException

HTTP error code with description.

Notes

When a token with the given name already exists, the existing token is invalidated.

list_tokens

List the names of the API tokens which the current logged-in user has created.

Returns:

Type Description
List[NonEmptyString256]

List of token names.

Raises:

Type Description
QdlSdkException

HTTP error code with description.

remove_token

Remove an API token with the given name from QDL for the current logged-in user.

Parameters:

Name Type Description Default
name str

Name of the token to remove.

required

Raises:

Type Description
QdlSdkException

HTTP error code with description.

set_token

Set the given API token for the SDK to authenticate with QDL.

Parameters:

Name Type Description Default
api_token Optional[AuthenticationToken]

API token to set for the SDK.

None

Raises:

Type Description
ValueError

Invalid API token.

QdlSdkException

HTTP error code with description.

Notes

Once set, the SDK will automatically use this token by default after each restart.

me

Get information about the current logged-in user from QDL.

Returns:

Type Description
DictStrAny

User information as a dictionary.

Raises:

Type Description
QdlSdkException

HTTP error code with description.