Skip to main content

bulutklinik-sdk

Official Bulutklinik API SDK for Python. Sync and async (httpx), fully typed (py.typed), Python 3.9+.

Covers the patient flow: auth, doctor search, slots, appointments, payments, and health measures. See DESIGN.md for the full wire contract.

Install

pip install bulutklinik-sdk

Quick start (sync)

from bulutklinik import BulutklinikClient

with BulutklinikClient(
    environment="production",  # "production" | "test" | "local"
    client_id="…",
    client_secret="…",
) as client:
    # 1) Log in (tokens are stored automatically)
    login = client.auth.connect("patient@example.com", "•••••••", "email")

    if login.two_factor_required:
        client.auth.connect_with_two_factor("123456", login.two_factor_response)

    # 2) Find a doctor
    result = client.doctors.search(
        search_params={"withFreeText": "kardiyoloji"},
        order_params=["slot"],
        other_params=["isInterviewable"],
    )

    # 3) Slots, then 4) reserve ("YYYY-MM-DD HH:mm")
    doctor_id = result["foundDoctors"][0]["doctor_id"]
    slots = client.slots.schedule(doctor_id, "interview")
    client.appointments.reserve_interview(doctor_id, "2026-06-20 14:30")

Quick start (async)

from bulutklinik import AsyncBulutklinikClient

async with AsyncBulutklinikClient(environment="production", client_id="…", client_secret="…") as client:
    await client.auth.connect("patient@example.com", "•••••••", "email")
    result = await client.doctors.search(search_params={"withFreeText": "kardiyoloji"})

Services

Group Methods
client.auth connect, connect_with_two_factor, register, refresh, disconnect
client.doctors branches, locations, quick_search, search, detail
client.slots schedule
client.appointments reserve_interview, add_physical, cancel
client.payments check_discount_code, get_cards, save_card, pay, delete_card
client.measures add_list, add, update, delete, last, list, graph, partner_health_information
client.skin analyze
client.meals analyze
client.laboratory results, result_detail, catalog, catalog_detail, order
client.diets list, detail

The async client exposes the same methods (awaitable) under the same names.

Authentication & tokens

  • connect / connect_with_two_factor / register store the access + refresh tokens automatically.
  • On a 401 (or resultType 4), the SDK silently refreshes once and retries.
  • Provide a custom token store by implementing bulutklinik.TokenStore and passing it via token_store=….

Payments (3-D Secure)

payments.pay(...) returns a dict with payment3DUrl on a 3DS flow. Open that URL in a browser; the bank → server callback completes the capture. The SDK never opens or parses the URL.

Health measures

client.measures.add_list([
    {"type": "tension", "date_time": "2026-06-17 09:30", "hypertension": 120, "hypotension": 80},
    {"type": "glucose", "date_time": "2026-06-17 09:35", "glucose": 95, "glucose_type": 0},
])

client.measures.last()
client.measures.list("glucose", 1, 0)  # glucose_type 0=fasting, 1=postprandial
client.measures.graph("tension", 2, 1)  # period 2 = weekly

The partner endpoint (partner_health_information) uses partner_token from the client config. The API currently matches the patient by phone_number; pass both identity and phone_number for forward compatibility.

AI image analysis

# "Cildimde Neyim Var" — analyze one or more skin photos (base64)
result = client.skin.analyze([{"image": b64}])
for s in result["status"]:
    print(s["label"], s["comment"], s["possible_icd"])
    # s["case_detail"] can be forwarded verbatim as a payment's case_detail

# Meal photo → calorie/nutrition estimate
meal = client.meals.analyze(
    image=b64,
    portion_size="medium",  # small | medium | large | custom
    meal_type="lunch",       # breakfast | lunch | dinner | snack
    # portion_grams=300,     # required when portion_size is "custom"
    # note="az yağlı",
)
print(meal["status"]["comment"])

Laboratory & diets

# Lab results (page optional; omit for page 1). Result ids may carry a "-lab" suffix.
results = client.laboratory.results()          # or .results(2)
detail = client.laboratory.result_detail("4821-lab")

# Orderable test catalog, then pre-order (all three ids required)
catalog = client.laboratory.catalog()
group = client.laboratory.catalog_detail(7)
order = client.laboratory.order(test_id=12, address_id=34, laboratory_id=56)
print(order["preOrderId"])

# Diet lists written by the dietitian (JSON only)
diets = client.diets.list()                    # or .list(2)
plan = client.diets.detail(diets["foundDiets"][0]["list_id"])

Errors

All errors subclass bulutklinik.BulutklinikError:

TransportError (network) · ApiErrorValidationError (422), AuthenticationError (401 / logout), AuthorizationError (403), NotFoundError (404), RateLimitError (429, .retry_after). Attributes: http_status, result_type, error_type, data, method, path, retry_after.

from bulutklinik import RateLimitError, ValidationError

try:
    client.payments.pay(doctor_id, "2026-06-20 14:30", is_3d=True, terms_accept=True, card_id=5)
except RateLimitError as exc:
    print("retry after", exc.retry_after)
except ValidationError as exc:
    print("invalid:", exc.data)

Development

pip install -e ".[dev]"
ruff check .
ruff format --check .
mypy
pytest

License

MIT

Download files

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

Source Distribution

bulutklinik_sdk-0.4.0.tar.gz (33.4 kB view details)

Uploaded Source

Built Distribution

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

bulutklinik_sdk-0.4.0-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file bulutklinik_sdk-0.4.0.tar.gz.

File metadata

  • Download URL: bulutklinik_sdk-0.4.0.tar.gz
  • Upload date:
  • Size: 33.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for bulutklinik_sdk-0.4.0.tar.gz
Algorithm Hash digest
SHA256 3fae9783d36e53e1079465d74289cc127dc27bbbb195fae4b93d5ac00858aa89
MD5 80a60354cd80c5b5a89e87c3ac093a98
BLAKE2b-256 8be9e19bf5f8a8c9cc5f8d3a410bd5ac4da79727b24d1272bd7129401c4bd484

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulutklinik_sdk-0.4.0.tar.gz:

Publisher: publish.yml on bulutklinik/python-sdk

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

File details

Details for the file bulutklinik_sdk-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: bulutklinik_sdk-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 20.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for bulutklinik_sdk-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f6272876f5d2abfe0ce555456f19d1d3604a55f9a6ff0e4ca713c39000eab14
MD5 3e9946b27afa93dadb699aa32b673416
BLAKE2b-256 74225fdad8b76fe2ad42778b0ff686494bebb3ac9bfd6a958dff015b20593816

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulutklinik_sdk-0.4.0-py3-none-any.whl:

Publisher: publish.yml on bulutklinik/python-sdk

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

Release history Release notifications | RSS feed

1.1.0

2 files

1.0.1

2 files

0.6.0

2 files

This release

0.4.0 This release

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

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