> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.emtelligent.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.emtelligent.com/_mcp/server.

# auth

This module contains all the classes and methods necessary for authenticating
with the API.

There's no need to use any of these if using the Emtellipro class since that
class uses this module internally.

## Module Contents

### Classes

| Name                                                            | Description                                                                                                       |
| --------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| [`AuthenticationDetails`](#emtelliproauthauthenticationdetails) | Conveniently stores the authentication details (access key, secret key) for use with all functions which require. |
| [`APIKey`](#emtelliproauthapikey)                               | Container for the API key.                                                                                        |

### Functions

| Name                                                                    | Description                                                                                                                                  |
| ----------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| [`sign_request`](#emtelliproauthsign_request)                           | Adds the necessary headers for authentication, in place, given the `authdetails` this class was instantiated with.                           |
| [`gen_auth_header`](#emtelliproauthgen_auth_header)                     | Generates the cmplete HMAC Authorization header which contains the necessary signature for the request, and the details needed to verify it. |
| [`string_to_sign`](#emtelliproauthstring_to_sign)                       | Given a Request object, this computes the string which the client needs to sign to verify the validity of the request.                       |
| [`compute_canonical_request`](#emtelliproauthcompute_canonical_request) | Given a Request object, this computes the canonical request string which is then used for computing the signature of the request.            |

### Data

`_headers_to_sign`

### API

#### `emtellipro.auth.AuthenticationDetails`

```python
class emtellipro.auth.AuthenticationDetails(accesskey, secretkey)
```

**Bases:** object

Conveniently stores the authentication details (access key, secret key) for
use with all functions which require.

##### Initialization

**Parameters:**

* **accesskey**: the API key used to identify the user
* **secretkey**: the API key used to sign messages

##### `AuthenticationDetails.accesskey`

```python
property accesskey
```

The access key stored in this object. Read-only.

##### `AuthenticationDetails.secretkey`

```python
property secretkey
```

The secret key stored in this object. Read-only.

#### `emtellipro.auth.APIKey`

```python
class emtellipro.auth.APIKey
```

**Bases:** object

Container for the API key.

*New in version 6.10.*

##### Initialization

```python
__init__(apikey)
```

##### `APIKey.apikey`

```python
apikey: str
```

The API key

#### `emtellipro.auth.sign_request`

```python
emtellipro.auth.sign_request(
    authdetails, request: httpx2.Request
) -> httpx2.Request
```

Adds the necessary headers for authentication, in place, given the
`authdetails` this class was instantiated with.

**Returns:**

The same request that was passed in.

**Return type:** `Request`

#### `emtellipro.auth.gen_auth_header`

```python
emtellipro.auth.gen_auth_header(
    request, auth_details: emtellipro.auth.AuthenticationDetails
)
```

Generates the cmplete HMAC Authorization header which contains the
necessary signature for the request, and the details needed to verify it.

**Parameters:**

**`request`**

The request to sign.

---

**`auth_details`** `emtellipro.auth.AuthenticationDetails`

The holder for the authentication details.

---

**Returns:**

The 'Authorization' header value.

#### `emtellipro.auth.string_to_sign`

```python
emtellipro.auth.string_to_sign(request)
```

Given a Request object, this computes the string which the client needs to
sign to verify the validity of the request.

**Parameters:**

**`request`**

The request to sign.

---

**Returns:**

The string that will need to be signed (this will contain the hash of
the request).

#### `emtellipro.auth.compute_canonical_request`

```python
emtellipro.auth.compute_canonical_request(request)
```

Given a Request object, this computes the canonical request string which is
then used for computing the signature of the request.

**Parameters:**

**`request`**

The request you want to sign.

---

**Returns:**

String representing the request in a consistent and deterministic
format.