Skip to main content

ShelfWatch Python SDK

Official Python client for ShelfWatch APIs v2.

pip install shelfwatch

Quick start

Create credentials in ShelfWatch Console → Integrations, then:

from shelfwatch import ShelfWatch

client = ShelfWatch(
    api_key="swpk_…",
    project_id="PROJECT_UUID",
)

visits = client.visits.list(
    start_date="2026-07-01",
    end_date="2026-07-31",
)
print(visits["data"])

detail = client.visits.get(
    visits["data"][0]["visit_uuid"],
    include_kpis=True,
)

OAuth client credentials

client = ShelfWatch(
    client_id="swoc_…",
    client_secret="swocs_…",
    project_id="PROJECT_UUID",
)
# Access tokens are fetched and refreshed automatically.

API coverage

Resource Methods
client.visits list, get
client.mdm stores, users, categories, brands, skus, schedules
client.reports list, generate

Filters that accept multiple values can be passed as a comma-separated string or a list:

client.visits.list(
    start_date="2026-07-01",
    end_date="2026-07-31",
    visit_status=["completed"],
    store_code=["S001", "S002"],
)

stores = client.mdm.stores(q="delhi")
reports = client.reports.list()
rows = client.reports.generate(
    "visit-level",
    start_date="2026-07-01",
    end_date="2026-07-07",
)

Full HTTP reference: ShelfWatch Console → Help and Support, or the apis-v2 docs.

Errors

Typed exceptions map to HTTP status codes:

Exception Status
ValidationError 400
AuthenticationError 401
ForbiddenError 403
NotFoundError 404
RateLimitError 429
ShelfWatchError other
from shelfwatch import ShelfWatch, NotFoundError

try:
    client.visits.get("missing-uuid")
except NotFoundError as exc:
    print(exc.status_code, exc.message)

Development

python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest

Publish to PyPI

./scripts/publish.sh --test   # TestPyPI
./scripts/publish.sh          # PyPI

Or manually:

pip install -e ".[publish]"
python3 -m build
python3 -m twine check dist/*
python3 -m twine upload dist/*

Bump version in pyproject.toml and shelfwatch/__init__.py / client.py User-Agent before each release.

Metadata

Release files for shelfwatch 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shelfwatch 0.1.0
File Size Uploaded
shelfwatch-0.1.0.tar.gz 10.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for shelfwatch 0.1.0
File Interpreter ABI Platform
shelfwatch-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.7 kB

Release files / shelfwatch-0.1.0.tar.gz

Download URL shelfwatch-0.1.0.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a86d72cb9297c605f902927768945fb34544b703a937794cec03577f786739fd
BLAKE2b-256 checksum
How to use checksums
ec45c5319a17eb67c739701efa7063440ead03ecb5d13c9e70096d70ad2cd648
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / shelfwatch-0.1.0-py3-none-any.whl

Download URL shelfwatch-0.1.0-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03810821b05182f78a00edba730ba24742311be8c3e568294b5c8755e643bebc
BLAKE2b-256 checksum
How to use checksums
e89da7cbc19f5ef422c1c5c595330cd066efc1d6b877698037e4951c814a5095
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page