Skip to main content

Typesafe async read-only SDK for the kaloricketabulky.cz internal API.

Project description

kaloricketabulky-sdk

lint pytest codecov PyPI Python License Docs

Typesafe, async, read-only access to the kaloricketabulky.cz internal API. The SDK layer (kaloricketabulky.sdk) is self-contained and usable on its own; the surrounding package adds configuration and a command-line entry point.

The site has no official public API. This is an unofficial client built against the endpoints the web app uses. Use it for your own data only, be a respectful guest: don't hammer the site with requests, keep your polling slow and infrequent, and don't be a dick about it.

If you get value out of kaloricketabulky.cz, please consider supporting them with a subscription.

Requirements

  • Python >= 3.12
  • uv

Install

uv add kaloricketabulky-sdk

Usage

import asyncio
from datetime import date

from kaloricketabulky.sdk import KaloricketabulkyClient, SnapshotType


async def main() -> None:
    async with KaloricketabulkyClient() as client:
        await client.login("you@example.com", "password")

        diary = await client.get_diary(date(2026, 6, 2))
        streak = await client.get_streak(date(2026, 6, 2))
        weight = await client.get_snapshot(SnapshotType.WEIGHT, date(2025, 6, 2), date(2026, 6, 2))
        print(diary.energy_total, streak, weight.min, weight.max)


asyncio.run(main())

login stores the session cookies on the underlying HTTP client and later requests reuse them. The session can expire; if a request starts failing, call login again.

CLI

Set KALORICKETABULKY_EMAIL + KALORICKETABULKY_PASSWORD in your environment or a .env file, then:

uv run kaloricketabulky streak --date 2026-06-02
uv run kaloricketabulky diary --date 2026-06-02
uv run kaloricketabulky snapshot --metric weight --from 2025-06-02 --to 2026-06-02

Retries

The SDK ships no retry logic, to stay thin and to avoid hammering an unofficial API. To add retries or backoff, inject your own client — for example connection-level retries:

import httpx
from kaloricketabulky.sdk import KaloricketabulkyClient

async with httpx.AsyncClient(
    base_url="https://www.kaloricketabulky.cz",
    transport=httpx.AsyncHTTPTransport(retries=3),
) as http:
    client = KaloricketabulkyClient(client=http)
    await client.login("you@example.com", "password")
    ...

A supplied client is not closed by KaloricketabulkyClient — manage its lifecycle yourself (e.g. async with). Note that login (and any Set-Cookie the server returns) populates the client's cookie jar; that is how the session is carried. A supplied client must set its own base_url; the base_url= argument applies only when KaloricketabulkyClient creates its own HTTP client. Unsure which URL? Reuse Settings.base_url from kaloricketabulky.config.

Development

uv sync                      # create the environment from the lockfile
uv run pytest                # run tests with coverage
uv run ruff format --check . # check formatting
uv run ruff check .          # lint
uv run mypy src tests        # strict type-check

Layout

src/kaloricketabulky/
    __init__.py    package version
    __main__.py    command-line entry point (`kaloricketabulky`)
    sdk/           standalone read-only SDK (httpx + pydantic only)
tests/             test suite

Releases

Versioning and the changelog are driven by Commitizen. Do not edit CHANGELOG.md by hand:

uv run cz bump

License

MIT

Project details


Download files

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

Source Distribution

kaloricketabulky_sdk-0.1.0.tar.gz (113.0 kB view details)

Uploaded Source

Built Distribution

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

kaloricketabulky_sdk-0.1.0-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kaloricketabulky_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 113.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kaloricketabulky_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 727bb038f37729b41218e2eb2717ccb52c0e248ac2182edad8058b6c18f6e5dc
MD5 0dce132e6eea3bc09d676d05f5b98320
BLAKE2b-256 55309f76ec8b0208f9b9bcf9ea7e5e15fda2fa3f6cc04f68f15e31b7b9edd3de

See more details on using hashes here.

Provenance

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

Publisher: release.yml on tomasvotava/kaloricketabulky

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

File details

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

File metadata

File hashes

Hashes for kaloricketabulky_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 880bb835259b53ccb403838b55239305e866067e31b14d3e32a77f73e97b2292
MD5 a8f57845c24076ee0cd4d051ea8ac6ab
BLAKE2b-256 b2ceeb8df0e3702f25f946d7bbd635f6ed8fb1c1b9f5a51c0e6be8ef6c77d695

See more details on using hashes here.

Provenance

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

Publisher: release.yml on tomasvotava/kaloricketabulky

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

Supported by

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