Skip to main content

batch-label

Overview

Generates labels for multiple Snipe-IT assets in a single batch. Fetches asset data from the Snipe-IT API, creates labels via the label-service, downloads print-ready PNGs, and optionally sends them to the Brother PT-D610BT printer. Supports filtering by asset ID, range, location, or category.

Usage

python scripts/batch-label.py [ASSET_IDS...] [OPTIONS]

Arguments

ArgumentDescription
ASSET_IDSSnipe-IT hardware IDs -- individual (76 81), ranges (50-76), or omit with --all

Options

OptionDescriptionDefault
--allProcess all hardware assets--
--location IDFilter by Snipe-IT location ID--
--category NAMEFilter by category name (partial match)--
--skip-existingSkip assets that already have active labels--
--dry-runShow plan without making changes--
--printSend to Brother PT-D610BT after download--
--output-dir DIROutput directory for PNGslabels/
--label-url URLLabel service base URLhttp://localhost:8100

Prerequisites

  • Repo: snipeit-asset-management
  • Install: pip install requests Pillow
  • Environment: SNIPEIT_TOKEN, LABEL_SERVICE_API_KEY
  • Services: Label-service running (docker compose up -d in src/label-service/)
  • Printer: Brother PT-D610BT with b-PAC SDK v3.4+ (for --print)

Examples

Generate labels for specific assets

python scripts/batch-label.py 76 81 163

Generate labels for a range

python scripts/batch-label.py 50-76

Dry run for all assets in a location

python scripts/batch-label.py --location 2 --dry-run

Generate and print, skipping existing

python scripts/batch-label.py --all --skip-existing --print

Output

PNG files saved to labels/ directory, named by asset tag (e.g., ASSET-0050.png). Summary report printed to console showing created, skipped, and failed counts.