snipeit-asset-management CLI
Repo: snipeit-asset-management (private)
CLI entry point: python scripts/<script>.py
Framework: argparse + FastAPI (label-service)
Language: Python 3.11+
Asset tracking workflows and label printing for Snipe-IT. Includes Python CLI scripts for label generation and asset export, plus a FastAPI label-service that manages label lifecycle and generates print-ready images for the Brother PT-D610BT.
CLI Scripts
Label Generation and Printing
| Script | Description | Docs |
|---|---|---|
batch-label.py | Batch-generate labels for multiple assets | View |
print-label.py | Generate print-ready label for one or more assets | -- |
print-to-brother.py | Send PNG labels to Brother PT-D610BT printer | -- |
Asset Export
| Script | Description | Docs |
|---|---|---|
export_location.py | Export assets by location to PDF, HTML, or CSV | -- |
Testing
| Script | Description | Docs |
|---|---|---|
test-label-e2e.py | End-to-end validation of label pipeline | -- |
Label-Service API
The label-service runs as a Docker container (ra_labels) on port 8100. It manages label lifecycle (draft, active, voided, retired) and generates QR codes, barcodes, and print-ready PNGs.
Key Endpoints
| Endpoint | Method | Description |
|---|---|---|
/health | GET | Service health check |
/api/v1/labels | POST | Create a new label (draft state) |
/api/v1/labels | GET | List labels with filtering |
/api/v1/labels/batch | POST | Batch-create labels |
/api/v1/labels/{id}/activate | POST | Activate a draft label |
/api/v1/labels/{id}/print | GET | Generate print-ready PNG |
/api/v1/labels/{id}/qr | GET | Generate QR code PNG |
/{asset_identifier} | GET | Scan label (redirects to Snipe-IT) |
Authenticated endpoints require X-API-Key header.
Prerequisites
- Python 3.11+ with
requests,Pillow,reportlab - Docker Desktop (for label-service)
SNIPEIT_TOKEN-- Snipe-IT API bearer tokenLABEL_SERVICE_URL-- Label service base URL (default:http://localhost:8100)LABEL_SERVICE_API_KEY-- Label service API key- Brother PT-D610BT with b-PAC SDK v3.4+ (for printing)