# snaps_uploader

Python API: `depthai_nodes.node.snaps_uploader`

## Classes

| Name | Description |
| --- | --- |
| [`SnapsUploader`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/snaps_uploader.md#snaps_uploader-Classes-SnapsUploader) | Upload `SnapData` messages through the native Hub EventsManager. |

### class `SnapsUploader`

```python
class SnapsUploader(BaseHostNode)
```

Upload `SnapData` messages through the native Hub EventsManager.

Configure the API token and optional local caching before starting the pipeline. Upload failures are logged; offline caching is
controlled by the native manager.

Methods

| Name | Description |
| --- | --- |
| [`__init__`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/snaps_uploader.md#snaps_uploader-Classes-SnapsUploader-__init__) | Initialize logging and the platform-specific output image format. |
| [`build`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/snaps_uploader.md#snaps_uploader-Classes-SnapsUploader-build) | Connect a stream of snap payloads. |
| [`process`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/snaps_uploader.md#snaps_uploader-Classes-SnapsUploader-process) | Submit one snap and log whether the native upload succeeded. |
| [`setCacheDir`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/snaps_uploader.md#snaps_uploader-Classes-SnapsUploader-setCacheDir) | Set the EventsManager directory for cached uploads. |
| [`setCacheIfCannotSend`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/snaps_uploader.md#snaps_uploader-Classes-SnapsUploader-setCacheIfCannotSend) | Configure caching when a snap cannot be uploaded. |
| [`setLogResponse`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/snaps_uploader.md#snaps_uploader-Classes-SnapsUploader-setLogResponse) | Configure native server-response logging. |
| [`setToken`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/snaps_uploader.md#snaps_uploader-Classes-SnapsUploader-setToken) | Set a Hub API token only when the environment does not already define one. |

#### method `__init__`

```python
def __init__()
```

Initialize logging and the platform-specific output image format.

Raises

| Type | Description |
| --- | --- |
| `ValueError` | If the pipeline device platform has no configured image-frame format. |

#### method `build`

```python
def build(snaps: dai.Node.Output)
```

Connect a stream of snap payloads.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `snaps` | `dai.Node.Output` | Output producing `SnapData` messages. | required |

Returns

| Type | Description |
| --- | --- |
|  | This uploader node. |

#### method `process`

```python
def process(snap: dai.Buffer)
```

Submit one snap and log whether the native upload succeeded.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `snap` | `dai.Buffer` | `SnapData` containing the name, file group, tags, and metadata. | required |

Raises

| Type | Description |
| --- | --- |
| `AssertionError` | If the input is not a `SnapData` message. |

#### method `setCacheDir`

```python
def setCacheDir(cacheDir: str)
```

Set the EventsManager directory for cached uploads.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `cacheDir` | `str` | Local cache directory passed to the native EventsManager. | required |

#### method `setCacheIfCannotSend`

```python
def setCacheIfCannotSend(cacheIfCannotUpload: bool)
```

Configure caching when a snap cannot be uploaded.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `cacheIfCannotUpload` | `bool` | Whether the native EventsManager should cache unsent snaps. | required |

#### method `setLogResponse`

```python
def setLogResponse(logResponse: bool)
```

Configure native server-response logging.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `logResponse` | `bool` | Whether upload responses appear in DepthAI INFO logs. | required |

#### method `setToken`

```python
def setToken(token: str)
```

Set a Hub API token only when the environment does not already define one.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `token` | `str` | Value assigned to `DEPTHAI_HUB_API_KEY` if that environment variable is absent. An existing value is preserved. | required |

## Module Attributes

| Name | Description |
| --- | --- |
| [`logger`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/snaps_uploader.md#snaps_uploader-Module-Attributes-logger) |  |

### variable `logger`

```python
logger = logging.getLogger(__name__)
```
