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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c37c686dd952b337c8a8f81a6c6bd98cceaf30820417ee00bce0d3982b434e8c
|
|
| MD5 |
774dee8646c5744e5a051a1166d6db01
|
|
| BLAKE2b-256 |
c2e17f34dd4b80a5018f64c8fe7cde2974fa449c166b99dc6ec699e8602c4280
|
Provenance
The following attestation bundles were made for snipepy-0.1.0.tar.gz:
Publisher:
pypi-publish.yml on programmer-666/snipepy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
snipepy-0.1.0.tar.gz -
Subject digest:
c37c686dd952b337c8a8f81a6c6bd98cceaf30820417ee00bce0d3982b434e8c - Sigstore transparency entry: 2575733930
- Sigstore integration time:
-
Permalink:
programmer-666/snipepy@9b1d6df7e9db488c3100145e221b088180835d62 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/programmer-666
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@9b1d6df7e9db488c3100145e221b088180835d62 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
261eeee01c318d1f81029a1c06e9ac4f513fc195e6999a94505ca9f603a809b5
|
|
| MD5 |
74294439bb67a42ebb97b1a2661ede51
|
|
| BLAKE2b-256 |
3fda95b57278f8218c907c89bb9e725283af103b788f078c19ed789558060eee
|
Provenance
The following attestation bundles were made for snipepy-0.1.0-py3-none-any.whl:
Publisher:
pypi-publish.yml on programmer-666/snipepy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
snipepy-0.1.0-py3-none-any.whl -
Subject digest:
261eeee01c318d1f81029a1c06e9ac4f513fc195e6999a94505ca9f603a809b5 - Sigstore transparency entry: 2575733984
- Sigstore integration time:
-
Permalink:
programmer-666/snipepy@9b1d6df7e9db488c3100145e221b088180835d62 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/programmer-666
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@9b1d6df7e9db488c3100145e221b088180835d62 -
Trigger Event:
release
-
Statement type: