Async Python client for the Karakeep API
Project description
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
aiohttp3.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 examplehttps://karakeep.example.comtoken: Karakeep API tokensession: caller-ownedaiohttp.ClientSessiontimeout: optional request timeout in seconds, defaulting to15
Available methods:
async_get_stats()callsGET /api/v1/users/me/statsand returns the JSON object from Karakeep.async_get_health()callsGET /api/healthand returns the JSON object plusstatus_code. If the endpoint returns non-JSON content, the method returns{"status": "unknown", "status_code": ...}.async_get_version()callsGET /api/versionand returns the version string, orNonewhen 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, oraiohttpreported 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aiokarakeep-0.1.0.tar.gz.
File metadata
- Download URL: aiokarakeep-0.1.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c9a858126236cd5a79c17ab9a1eecda197c611d896c83b656107efacca568ad
|
|
| MD5 |
ee278a3d763090708eaac63c7191c2d1
|
|
| BLAKE2b-256 |
7b9be5eeba00aa12b9dbe009530ffd02dba4bb0d53749d712c0d07e3ee5ce4b1
|
Provenance
The following attestation bundles were made for aiokarakeep-0.1.0.tar.gz:
Publisher:
publish.yml on sli-cka/aiokarakeep
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aiokarakeep-0.1.0.tar.gz -
Subject digest:
0c9a858126236cd5a79c17ab9a1eecda197c611d896c83b656107efacca568ad - Sigstore transparency entry: 1569846895
- Sigstore integration time:
-
Permalink:
sli-cka/aiokarakeep@f1ee18700985a3fd900d4ea8bc677f02691da8ea -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/sli-cka
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f1ee18700985a3fd900d4ea8bc677f02691da8ea -
Trigger Event:
release
-
Statement type:
File details
Details for the file aiokarakeep-0.1.0-py3-none-any.whl.
File metadata
- Download URL: aiokarakeep-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fee89cf20ae504fc51e64dddd0b228b074754f13151f3dd4471a4240cbbf1fb7
|
|
| MD5 |
522544110200f407c1597860448eb595
|
|
| BLAKE2b-256 |
398213667315ebf15bb23920ab35fcbc45e5f7f822e0edab7248df002ae3b44e
|
Provenance
The following attestation bundles were made for aiokarakeep-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on sli-cka/aiokarakeep
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aiokarakeep-0.1.0-py3-none-any.whl -
Subject digest:
fee89cf20ae504fc51e64dddd0b228b074754f13151f3dd4471a4240cbbf1fb7 - Sigstore transparency entry: 1569846993
- Sigstore integration time:
-
Permalink:
sli-cka/aiokarakeep@f1ee18700985a3fd900d4ea8bc677f02691da8ea -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/sli-cka
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f1ee18700985a3fd900d4ea8bc677f02691da8ea -
Trigger Event:
release
-
Statement type: