Back to SDKs
Pythonv2.1.0
Python SDK
The official Pharmako SDK for Python applications. Supports Python 3.8+.
Installation
pip install pharmakoQuick Start
import os
from pharmako import Pharmako
# Initialize the client
client = Pharmako(api_key=os.environ["PHARMAKO_API_KEY"])
# Fetch a patient
patient = client.patients.get("patient_123")
print(patient.name)
# List lab results
labs = client.labs.list(patient_id="patient_123", limit=10)
for lab in labs:
print(f"{lab.test_name}: {lab.result}")
# Async support
import asyncio
from pharmako import AsyncPharmako
async def main():
async_client = AsyncPharmako(api_key="...")
patient = await async_client.patients.get("patient_123")
print(patient.name)
asyncio.run(main())Type Hints
Full type hint support for better IDE integration and type checking.
from pharmako import Pharmako
from pharmako.types import Patient, LabResult
client = Pharmako(api_key="...")
# Fully typed responses
patient: Patient = client.patients.get("patient_123")
# Type-safe parameters
labs: list[LabResult] = client.labs.list(
patient_id=patient.id,
status="completed",
order_by="created_at",
)