Metadata-Version: 2.4
Name: snipepy
Version: 0.1.0
Summary: Python wrapper for the SnipeIT REST API
Author-email: Süha Arslan <suha@suhaarslan.com>
License: Apache-2.0
Project-URL: Homepage, https://github.com/programmer-666/snipepy
Project-URL: Source, https://github.com/programmer-666/snipepy
Project-URL: Documentation, https://github.com/programmer-666/snipepy/tree/main/docs
Project-URL: Bug Tracker, https://github.com/programmer-666/snipepy/issues
Project-URL: Changelog, https://github.com/programmer-666/snipepy/tree/main/CHANGELOG.md
Keywords: api,asset-management,inventory,itam,python,snipeit,wrapper
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Systems Administration
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Operating System :: OS Independent
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.28.0
Requires-Dist: pydantic<3.0.0,>=2.0.0
Requires-Dist: python-dotenv>=1.0.0
Provides-Extra: dev
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: mypy>=1.15.0; extra == "dev"
Requires-Dist: types-requests>=2.28.0; extra == "dev"
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: tox>=4.0.0; extra == "dev"
Requires-Dist: hypothesis>=6.0.0; extra == "dev"
Requires-Dist: build>=0.10.0; extra == "dev"
Requires-Dist: twine>=4.0.0; extra == "dev"
Requires-Dist: vulture>=2.0.0; extra == "dev"
Requires-Dist: bandit>=1.7.0; extra == "dev"
Requires-Dist: setuptools_scm>=8; extra == "dev"
Dynamic: license-file

# snipepy

Python wrapper for the [SnipeIT](https://snipeitapp.com) REST API. SnipeIT Python API.

## Installation

```bash
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:

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

## Quick Start

```python
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`) |

```bash
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
