Skip to main content

pycellarion

PyPI CI License: MIT

Async Python client for the Cellarion wine-cellar API. It is the library behind the Home Assistant integration, and usable on its own by anything that wants to read a cellar or mark a bottle as consumed.

  • Async, typed, small. One dependency (aiohttp), py.typed, no I/O outside the calls you make.
  • Two credentials. A personal API token (cel_…, created in Cellarion under Settings → API tokens), or email and password used once to mint such a token. Passwords are never kept beyond the login they were given for.
  • Push events. Parses the server's text/event-stream and yields event names, so callers can refresh on change instead of polling.
  • Honest errors. Status codes map to a small exception hierarchy: CellarionAuthError (re-authenticate), CellarionScopeError (the token lacks a scope), CellarionTokensNotSupported and CellarionPushNotSupported (older servers), CellarionPushForbidden, and CellarionApiError for everything else.

Install

pip install pycellarion

Use

import aiohttp
from pycellarion import CellarionClient

async with aiohttp.ClientSession() as session:
    client = CellarionClient(session, "https://cellarion.app", token="cel_…")

    stats = await client.get_stats_overview()
    print(stats["stats"]["overview"]["totalBottles"])

    async for event in client.events_stream():
        if event == "_connected":
            continue
        print("something changed:", event)

Minting a token from email and password:

client = CellarionClient(session, "https://cellarion.app", "me@example.com", "secret")
await client.authenticate()
token = await client.async_create_api_token("My script", ["read", "consume"])
# keep `token`; the password is not needed again

API

Method Purpose
authenticate() Log in with email and password (session JWT); raises CellarionAuthError on bad credentials
async_create_api_token(name, scopes) Mint a personal API token (password login required)
get_stats_overview() / get_cellars() / get_notifications() / get_peak_bottles(limit) / get_health() Reads
get_account_id() Stable account id from /api/auth/whoami, or None on servers without it
consume_bottle(bottle_id, reason, rating, note) Mark a bottle as consumed
events_stream() Async iterator of push event names; yields "_connected" first
revoke_own_token() Ask the server to revoke the client's own API token (Cellarion 1.220+)

Responses are returned as plain dicts (JsonDict); bodies over MAX_BODY_BYTES (4 MiB) are refused.

Development

pip install -e ".[test]"
ruff check . && ruff format --check . && mypy src
pytest --cov

Releases are published to PyPI from GitHub releases through trusted publishing.

License

MIT

Metadata

Release files for pycellarion 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 pycellarion 0.1.0
File Size Uploaded Provenance
pycellarion-0.1.0.tar.gz 12.5 kB With provenance Details

Built distribution (wheel)

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

Total release size: 21.9 kB

Release files / pycellarion-0.1.0.tar.gz

Download URL pycellarion-0.1.0.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
041b85623529357900ddfcd3cff3e81b636400bf8c8fd304e31abbd627133449
BLAKE2b-256 checksum
How to use checksums
edd5fe032f360f9b3b23ee589e7bdc4cda2344e9330669068c1653c5ffe3393c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.

Transparency log

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

Download URL pycellarion-0.1.0-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8f88259df6ea75c51e6991b53d8e672f6e6b7fc14ca788ce1ee303322e5ad0c
BLAKE2b-256 checksum
How to use checksums
ab991fa7cdc51b63fa65af8c679778ac4b7ca2243c1a68162da5aa4fff79163a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.

Transparency log

Security for pycellarion 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pycellarion-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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