> ## Documentation Index
> Fetch the complete documentation index at: https://help.cryptolens.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Python 3: User

> Manage customer usernames, passwords and license associations.

Python 3 package `licensing 0.54`. [Reviewed source revision](https://github.com/Cryptolens/cryptolens-python/tree/8f38b5a37580f2aba1c9374f581cdc85e251950f).

```python theme={null}
from licensing.methods import User
```

These methods manage the usernames used by your software's customers. Returned license lists are dictionaries; activate the selected license when your licensing model calls for activation.

<a id="licensing.methods.User.login" />

## login

Retrieve the licenses associated with a customer's username and password.

```python theme={null}
User.login(token, username, password)
```

### Parameters

| Parameter | Default | Meaning |
| - | - | - |
| `token` | Required | Your access token. It needs the permission required by the linked Web API method. |
| `username` | Required | The customer's chosen username. |
| `password` | Required | The customer's password. |

### Result

Returns `(license_keys, '')`, where `license_keys` is the API's list of dictionaries.

Returns `(None, message)` for API rejection or a handled request failure. Malformed response data can raise an exception.

### Checks

The API checks the access token's permissions. This method does not verify a signed license response.

[Web API reference](/api-reference/generated/Login).

<a id="licensing.methods.User.register" />

## register

Register a customer username and password.

```python theme={null}
User.register(token, username, password, email='', customerId=0)
```

### Parameters

| Parameter | Default | Meaning |
| - | - | - |
| `token` | Required | Your access token. It needs the permission required by the linked Web API method. |
| `username` | Required | The customer's chosen username. |
| `password` | Required | The customer's password. |
| `email` | `''` | The customer's or user's email address. |
| `customerId` | `0` | The numeric customer ID to associate with the new user. |

### Result

Returns `(response_dict, '')`.

Returns `(None, message)` for API rejection or a handled request failure. Malformed response data can raise an exception.

### Checks

The API checks the access token's permissions. This method does not verify a signed license response.

[Web API reference](/api-reference/generated/Register).

<a id="licensing.methods.User.associate" />

## associate

Associate a user with a customer ID.

```python theme={null}
User.associate(token, username, customer_id=0)
```

### Parameters

| Parameter | Default | Meaning |
| - | - | - |
| `token` | Required | Your access token. It needs the permission required by the linked Web API method. |
| `username` | Required | The customer's chosen username. |
| `customer_id` | `0` | The numeric customer ID; see the method reference for the meaning of `0`. |

### Result

Returns `(response_dict, '')`.

Returns `(None, message)` for API rejection or a handled request failure. Malformed response data can raise an exception.

### Checks

The API checks the access token's permissions. This method does not verify a signed license response.

[Web API reference](/api-reference/generated/Associate).

<a id="licensing.methods.User.dissociate" />

## dissociate

Remove a user's customer association.

```python theme={null}
User.dissociate(token, username)
```

### Parameters

| Parameter | Default | Meaning |
| - | - | - |
| `token` | Required | Your access token. It needs the permission required by the linked Web API method. |
| `username` | Required | The customer's chosen username. |

### Result

Returns `(response_dict, '')`.

Returns `(None, message)` for API rejection or a handled request failure. Malformed response data can raise an exception.

### Checks

The API checks the access token's permissions. This method does not verify a signed license response.

[Web API reference](/api-reference/generated/Dissociate).

<a id="licensing.methods.User.get_users" />

## get\_users

List users, optionally filtered by customer.

```python theme={null}
User.get_users(token, customer_id=0)
```

### Parameters

| Parameter | Default | Meaning |
| - | - | - |
| `token` | Required | Your access token. It needs the permission required by the linked Web API method. |
| `customer_id` | `0` | The numeric customer ID; see the method reference for the meaning of `0`. |

### Result

Returns `(users, '')`, where `users` is a list of dictionaries.

Returns `(None, message)` for API rejection or a handled request failure. Malformed response data can raise an exception.

### Checks

The API checks the access token's permissions. This method does not verify a signed license response.

[Web API reference](/api-reference/generated/GetUsers).

<a id="licensing.methods.User.change_password" />

## change\_password

Change a user's password through the selected API workflow.

```python theme={null}
User.change_password(
    token,
    username,
    new_password,
    old_password='',
    password_reset_token='',
    admin_mode=False
)
```

### Parameters

| Parameter | Default | Meaning |
| - | - | - |
| `token` | Required | Your access token. It needs the permission required by the linked Web API method. |
| `username` | Required | The customer's chosen username. |
| `new_password` | Required | The replacement password. |
| `old_password` | `''` | The current password when using the password-change workflow. |
| `password_reset_token` | `''` | The reset credential from `User.reset_password_token`. |
| `admin_mode` | `False` | Whether to use the API's administrative password-change workflow. |

### Result

Returns `(response_dict, '')`.

Returns `(None, message)` for API rejection or a handled request failure. Malformed response data can raise an exception.

### Checks

The API checks the access token's permissions. This method does not verify a signed license response.

[Web API reference](/api-reference/generated/ChangePassword).

<a id="licensing.methods.User.reset_password_token" />

## reset\_password\_token

Request a password-reset credential for a user.

```python theme={null}
User.reset_password_token(token, username)
```

### Parameters

| Parameter | Default | Meaning |
| - | - | - |
| `token` | Required | Your access token. It needs the permission required by the linked Web API method. |
| `username` | Required | The customer's chosen username. |

### Result

Returns `(reset_credential, '')`, containing the API's `passwordResetToken` field.

Returns `(None, message)` for API rejection or a handled request failure. Malformed response data can raise an exception.

### Checks

The API checks the access token's permissions. This method does not verify a signed license response.

[Web API reference](/api-reference/generated/ResetPasswordToken).

<a id="licensing.methods.User.remove_user" />

## remove\_user

Remove a user.

```python theme={null}
User.remove_user(token, username)
```

### Parameters

| Parameter | Default | Meaning |
| - | - | - |
| `token` | Required | Your access token. It needs the permission required by the linked Web API method. |
| `username` | Required | The customer's chosen username. |

### Result

Returns `(response_dict, '')`.

Returns `(None, message)` for API rejection or a handled request failure. Malformed response data can raise an exception.

### Checks

The API checks the access token's permissions. This method does not verify a signed license response.

[Web API reference](/api-reference/generated/RemoveUser).

[Python SDK Reference](/libraries/python-api)
