Skip to main content

snipepy

Python wrapper for the SnipeIT REST API. SnipeIT Python API.

Installation

python -m pip install snipepy

Pre-release versions

This package is currently in alpha. Pre-release builds are published to TestPyPI and can be installed by pointing pip at the test index:

pip install \
  --index-url https://test.pypi.org/simple/ \
  --extra-index-url https://pypi.org/simple/ \
  snipepy

Quick Start

from snipepy import Snipepy

client = Snipepy.from_env()

# Query an asset
asset = client.assets.get(124)
print(asset.name, asset.asset_tag)

# List and filter
assets = client.assets.list(location_id=3, limit=50)
for a in assets.rows:
    print(a.asset_tag, a.status_label.name if a.status_label else "")

# Checkout to a user
client.assets.checkout(124, checkout_to_type="user", assigned_user=11)

# Checkout to a location
client.assets.checkout(124, checkout_to_type="location", assigned_location=5)

# Checkin
client.assets.checkin(124, note="Returned after repair")

# Create an asset
new_asset = client.assets.create(
    asset_tag="T00000999",
    status_id=1,
    model_id=3,
    name="Office Laptop",
)

# Error handling
from snipepy import SnipepyNotFoundError, SnipepyAuthError, SnipepyValidationError
try:
    asset = client.assets.get(999)
except SnipepyNotFoundError:
    print("Asset not found")
except SnipepyAuthError:
    print("Invalid API token")
except SnipepyValidationError as e:
    print(f"Validation failed: {e}")

Environment Variables

Variable Required Default Description
SNIPEPY_URL Yes : SnipeIT instance URL
SNIPEPY_API_TOKEN Yes : API token
SNIPEPY_TIMEOUT No 30 HTTP request timeout (seconds)
SNIPEPY_VERIFY_SSL No false SSL verification (true/false/1/0/yes)
cp .env.example .env
# Edit .env and fill in SNIPEPY_URL and SNIPEPY_API_TOKEN

Disclaimer

This software is provided as-is without warranty of any kind. The authors are not responsible for any damages or data loss arising from its use. Always test against a non-production SnipeIT instance before relying on this library in critical workflows.

License

Apache 2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

snipepy-0.1.0.tar.gz (301.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

snipepy-0.1.0-py3-none-any.whl (52.3 kB view details)

Uploaded Python 3

File details

Details for the file snipepy-0.1.0.tar.gz.

File metadata

  • Download URL: snipepy-0.1.0.tar.gz
  • Upload date:
  • Size: 301.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for snipepy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c37c686dd952b337c8a8f81a6c6bd98cceaf30820417ee00bce0d3982b434e8c
MD5 774dee8646c5744e5a051a1166d6db01
BLAKE2b-256 c2e17f34dd4b80a5018f64c8fe7cde2974fa449c166b99dc6ec699e8602c4280

See more details on using hashes here.

Provenance

The following attestation bundles were made for snipepy-0.1.0.tar.gz:

Publisher: pypi-publish.yml on programmer-666/snipepy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file snipepy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: snipepy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 52.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for snipepy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 261eeee01c318d1f81029a1c06e9ac4f513fc195e6999a94505ca9f603a809b5
MD5 74294439bb67a42ebb97b1a2661ede51
BLAKE2b-256 3fda95b57278f8218c907c89bb9e725283af103b788f078c19ed789558060eee

See more details on using hashes here.

Provenance

The following attestation bundles were made for snipepy-0.1.0-py3-none-any.whl:

Publisher: pypi-publish.yml on programmer-666/snipepy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page