Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Heyrafiki Python SDK

Typed Python client for the Heyrafiki API.

Install from source

Python 3.10 or newer is required. Keep API keys on the server.

git clone https://github.com/heyrafiki/rafiki-py.git
cd rafiki-py
python -m pip install -e .

The client connects to Sandbox projects with typed sync and async operations, caller-owned idempotency keys, bounded retries and the shared API error envelope.

First request

import os

from heyrafiki import create_client, unwrap
from heyrafiki.api.default import list_practitioners


with create_client(os.environ["HEYRAFIKI_API_KEY"]) as client:
    response = list_practitioners.sync_detailed(client=client, limit=5)
    practitioners = unwrap(response)

for practitioner in practitioners.data:
    print(practitioner.name)

Sandbox keys return synthetic data.

Covered Care

Writes that require idempotency expose idempotency_key as a required argument.

import datetime as dt
import os
import uuid

from heyrafiki import create_client, unwrap
from heyrafiki.api.default import create_booking
from heyrafiki.models import BookingInput


starts_at = dt.datetime.now(dt.timezone.utc) + dt.timedelta(days=1)
ends_at = starts_at + dt.timedelta(hours=1)

booking = BookingInput(
    practitioner_id="prc_2481",
    starts_at=starts_at,
    ends_at=ends_at,
    format_="online",
    payment_source="covered",
)

with create_client(os.environ["HEYRAFIKI_API_KEY"]) as client:
    response = create_booking.sync_detailed(
        client=client,
        body=booking,
        idempotency_key=str(uuid.uuid4()),
    )
    created = unwrap(response)

Amounts use the currency's minor unit.

Errors and retries

unwrap raises HeyrafikiApiError for documented API errors and retains the request ID.

from heyrafiki import HeyrafikiApiError

try:
    created = unwrap(response)
except HeyrafikiApiError as error:
    print(error.status_code, error.code, error.request_id)

The default retry policy is bounded to three attempts. It retries 429 and 503 responses for safe reads and for writes carrying an Idempotency-Key. Unkeyed writes are never retried automatically.

Sync and async

Every generated operation provides sync, sync_detailed, asyncio and asyncio_detailed functions. Use the detailed variants with unwrap when you want consistent error handling.

Contract

The client is generated from the public OpenAPI 3.1 contract. GENERATION.md records the contract revision, SHA-256 digest, generator version and the reviewed compatibility transform.

Develop

python -m pip install -e ".[dev]"
ruff check .
ruff format --check .
mypy
pytest
python -m build
python -m twine check dist/*

Contract generation requires Python 3.11 or newer. See GENERATION.md.

Resources

License

Licensed under the Apache License 2.0.

Download files

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

Source Distribution

heyrafiki-0.1.0b1.tar.gz (52.7 kB view details)

Uploaded Source

Built Distribution

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

heyrafiki-0.1.0b1-py3-none-any.whl (115.8 kB view details)

Uploaded Python 3

File details

Details for the file heyrafiki-0.1.0b1.tar.gz.

File metadata

  • Download URL: heyrafiki-0.1.0b1.tar.gz
  • Upload date:
  • Size: 52.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for heyrafiki-0.1.0b1.tar.gz
Algorithm Hash digest
SHA256 f5c21aaade62701e2d83cef0d3368255ad69eede0e826d95440d85918d7bcb80
MD5 3621533431c08edf3a2d74ddba559bf1
BLAKE2b-256 bef170e36b89ecd1613eeb67dd32b35cc73ca734ed70b1e5d7d524ac146dd7a7

See more details on using hashes here.

Provenance

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

Publisher: release.yml on heyrafiki/rafiki-py

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

File details

Details for the file heyrafiki-0.1.0b1-py3-none-any.whl.

File metadata

  • Download URL: heyrafiki-0.1.0b1-py3-none-any.whl
  • Upload date:
  • Size: 115.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for heyrafiki-0.1.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 4eb2844ffe2cb1ea967e2d486ae97c3a06dd77b4052b41d019711420f5356551
MD5 8ddf0fd0c54b4b8f001b8aadaaccace9
BLAKE2b-256 590f4e791b432b8df6511b16d8c4f7ca88e7cec0a5de3a038603f724aa845e7f

See more details on using hashes here.

Provenance

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

Publisher: release.yml on heyrafiki/rafiki-py

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

Release history Release notifications | RSS feed

This release

0.1.0b1 This release

2 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