Skip to main content

aiokarakeep

Async Python client for the Karakeep API.

This package is intended to provide the API communication layer for the Karakeep Home Assistant integration. It accepts an injected aiohttp ClientSession, which lets Home Assistant own connection pooling and lifecycle.

Requirements

  • Python 3.11 or newer
  • aiohttp 3.9 or newer

Installation

pip install aiokarakeep

Usage

from aiohttp import ClientSession
from aiokarakeep import KarakeepClient


async with ClientSession() as session:
    client = KarakeepClient(
        base_url="https://karakeep.example.com",
        token="YOUR_API_TOKEN",
        session=session,
    )
    stats = await client.async_get_stats()

API

KarakeepClient expects:

  • base_url: Karakeep instance URL, for example https://karakeep.example.com
  • token: Karakeep API token
  • session: caller-owned aiohttp.ClientSession
  • timeout: optional request timeout in seconds, defaulting to 15

Available methods:

  • async_get_stats() calls GET /api/v1/users/me/stats and returns the JSON object from Karakeep.
  • async_get_health() calls GET /api/health and returns the JSON object plus status_code. If the endpoint returns non-JSON content, the method returns {"status": "unknown", "status_code": ...}.
  • async_get_version() calls GET /api/version and returns the version string, or None when the endpoint is unavailable or does not expose a version.

Exceptions

The client maps transport and response failures to typed exceptions:

  • KarakeepAuthError: Karakeep returned HTTP 401 or 403.
  • KarakeepConnectionError: Karakeep could not be reached.
  • KarakeepTimeoutError: the request timed out.
  • KarakeepInvalidResponseError: Karakeep returned malformed or unexpected JSON.
  • KarakeepApiError: Karakeep returned another HTTP error, or aiohttp reported a generic client error.

All package exceptions inherit from KarakeepError.

Development

uv run --extra test pytest -q

Build and check release artifacts:

uv run --extra release python -m build --installer uv
uv run --extra release twine check dist/*

See RELEASE_CHECKLIST.md before publishing a release to PyPI.

Metadata

Release files for aiokarakeep 0.3.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 aiokarakeep 0.3.0
File Size Uploaded Provenance Actions
aiokarakeep-0.3.0.tar.gz 7.2 kB With provenance Details for aiokarakeep-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 13.6 kB

Release files / aiokarakeep-0.3.0.tar.gz

Download URL aiokarakeep-0.3.0.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0760ac3c2ad84c89258814ef4f4f4bded93c7cf69016db623f2acc98ae29fe63
BLAKE2b-256 checksum
How to use checksums
be9037ab6ecc5894745bc4a96ec54d21e62abf4d670e26193e2ebc7e955c7def
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 17, 2026.

Transparency log

Release files / aiokarakeep-0.3.0-py3-none-any.whl

Download URL aiokarakeep-0.3.0-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e7f7e0f171554d165d5db5308e3c1b8dac1a0474d119ef2f082cb514707c161e
BLAKE2b-256 checksum
How to use checksums
b5b073b1d8747ad8e35e9760c0e0bf394dc939ba899507a64b0bdfa3887e959b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 17, 2026.

Transparency log

Security for aiokarakeep 0.3.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 aiokarakeep-0.3.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 Jun 17, 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.

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