Metadata-Version: 2.5
Name: vetvise-vms-client
Version: 0.1.0
Summary: Python client for the VetVise VMS REST API
Project-URL: Homepage, https://vetvise.com
Project-URL: API Documentation, https://external.dev.apidoc.vetvise.dev/
Project-URL: Wiki, https://vetvise.atlassian.net/wiki/spaces/VMSWiki/overview?homepageId=2060910681
Author: VetVise GmbH
License-Expression: Apache-2.0
License-File: LICENSE
License-File: NOTICE
Keywords: api-client,camera,livestock,vetvise,vms
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.12
Requires-Dist: cryptography>=50.0.2
Requires-Dist: numpy>=2.5.5
Requires-Dist: opencv-python
Requires-Dist: pandas>=3.1.1
Requires-Dist: pillow
Requires-Dist: urllib3>=2.8.0
Description-Content-Type: text/markdown

# vetvise-vms-client

Python client for the REST API of the VetVise Management System (VMS).

It handles service account authentication and wraps the most common endpoints:
cameras, still frames, recordings, timeseries data, artifacts, incidents, pens,
regions, reports and data collection.

- Website: [vetvise.com](https://vetvise.com)
- REST API documentation: [external.dev.apidoc.vetvise.dev](https://external.dev.apidoc.vetvise.dev/)
- VMS Wiki: [VMSWiki](https://vetvise.atlassian.net/wiki/spaces/VMSWiki/overview?homepageId=2060910681)

## Installation

```bash
pip install vetvise-vms-client
```

Requires Python 3.12 or newer.

## Configuration

Servers are configured in a JSON file, keyed by an alias of your choice:

```json
{
  "my-barn": {
    "protocol": "https",
    "hostname": "vms.example.com",
    "port": 443,
    "service_account_name": "my-service-account",
    "fingerprint": "<public key fingerprint>",
    "private_key": "/path/to/private_key.pem"
  }
}
```

`private_key` is either a path to a PEM file or the PEM content itself.
Keep this file out of version control.

## Usage

```python
import time

from vms import VMS

vms = VMS("servers.json")
server = vms.get_instance("my-barn")

# Basic info
server.api.base.is_online()
server.api.base.get_version()

# Cameras and frames
camera_ids = server.api.cameras.get_camera_ids()
jpeg = server.api.frames.get_current_thumbnail_frame(camera_ids[0])
frame = server.api.frames.get_frame(camera_ids[0], time.time() * 1000)

# Timeseries data
server.api.timeseries.get_measurements()
df = server.api.timeseries.get_simple_measurement(
    "activity", "activity",
    start=(time.time() - 6 * 3600) * 1000,
    response_type="dataframe",
)

# Document collections support query / query_one / get_specific
latest = server.api.recordings.query_one({"order": {"timestamp": "desc"}})
reports = server.api.reports.query({"limit": 10})

# Regions
mappings = server.api.regions.get_mappings_for_camera(camera_ids[0])

# Stitch all cameras into one canvas image (PIL.Image)
canvas = server.helpers.canvas.build_canvas(image_source="stillFrame")
```

Authentication happens automatically on the first request and is renewed when
the access token expires. Failed requests raise `vms.RequestFailed`, which
carries the HTTP `status`, `reason` and response `body`.

Which endpoints a service account can use depends on the permissions it has
been granted in the VMS. For endpoints and query syntax not covered by this
client, see the [REST API documentation](https://external.dev.apidoc.vetvise.dev/).

## License

Apache License 2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
Copyright 2026 VetVise GmbH.
