# snaps_uploader

Python API: `depthai_nodes.node.snaps_uploader`

## Classes

### SnapsUploader

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

##### init

```python
def __init__(self):
```

Initialize logging and the platform-specific output image format.

Raises

 * `ValueError`: If the pipeline device platform has no configured image-frame format.

##### build

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

Connect a stream of snap payloads.

Parameters

 * `snaps` (`dai.Node.Output`): Output producing `SnapData` messages.

Returns

 * This uploader node.

##### process

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

Submit one snap and log whether the native upload succeeded.

Parameters

 * `snap` (`dai.Buffer`): `SnapData` containing the name, file group, tags, and metadata.

Raises

 * `AssertionError`: If the input is not a `SnapData` message.

##### setCacheDir

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

Set the EventsManager directory for cached uploads.

Parameters

 * `cacheDir` (`str`): Local cache directory passed to the native EventsManager.

##### setCacheIfCannotSend

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

Configure caching when a snap cannot be uploaded.

Parameters

 * `cacheIfCannotUpload` (`bool`): Whether the native EventsManager should cache unsent snaps.

##### setLogResponse

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

Configure native server-response logging.

Parameters

 * `logResponse` (`bool`): Whether upload responses appear in DepthAI INFO logs.

##### setToken

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

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

Parameters

 * `token` (`str`): Value assigned to `DEPTHAI_HUB_API_KEY` if that environment variable is absent. An existing value is
   preserved.

## Attributes

### logger
