# environ

Python API: `hubai_sdk.utils.environ`

Resolve HubAI connection settings and securely stored credentials.

## Classes

| Name | Description |
| --- | --- |
| [`Environ`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/environ.md) | HubAI
settings loaded from environment variables and keyring. |

### class `Environ`

```python
class Environ(BaseEnviron)
```

HubAI settings loaded from environment variables and keyring.

Attributes

| Name | Type | Description |
| --- | --- | --- |
| `HUBAI_API_KEY` | `str | None` | API key used to authenticate requests. A key stored by `hubai login` takes precedence over the
environment variable. |
| `HUBAI_URL` | `str` | Base URL for HubAI services. Override this for staging or a self-hosted environment. |

Methods

| Name | Description |
| --- | --- |
|
[`validate_hubai_api_key`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/environ.md)
| Populate `HUBAI_API_KEY` from keyring when available. |

#### method `validate_hubai_api_key`

```python
def validate_hubai_api_key() -> Self
```

Populate `HUBAI_API_KEY` from keyring when available.

## Functions

| Name | Description |
| --- | --- |
|
[`get_password_with_timeout`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/environ.md)
| Read a keyring password with a timeout using multiprocessing. |
|
[`get_password_with_timeout_win`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/environ.md)
| Read a keyring password with a timeout using a subprocess. |

### function `get_password_with_timeout`

```python
def get_password_with_timeout(
    service_name: str,
    username: str,
    timeout: float = 5,
) -> str | None
```

Read a keyring password with a timeout using multiprocessing.

### function `get_password_with_timeout_win`

```python
def get_password_with_timeout_win(
    service_name: str,
    username: str,
    timeout: float = 5,
) -> str | None
```

Read a keyring password with a timeout using a subprocess.

## Module Attributes

| Name | Description |
| --- | --- |
| [`environ`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/environ.md) |  |

### variable `environ`

```python
environ = Environ()
```
