Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
dsinghvi authored Aug 28, 2023
1 parent 0484716 commit a625376
Showing 1 changed file with 72 additions and 6 deletions.
78 changes: 72 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,85 @@

API reference documentation is available [here](https://docs.metriport.com/home/welcome).

## Usage
## Installation

Add this dependency to your project's build file:

```bash
pip install fern-metriport
# or
poetry add fern-metriport
```

## Usage
```python
from metriport import BaseOrganization, OrgType, Address, UsState
from metriport.client import Metriport

metriport_client = Metriport(api_key="YOUR_API_KEY")

document = metriport_client.document.get(
patient_id='some-patient-id',
facility_id='some-facility-id',
)
document = metriport_client.medical.organization.create(BaseOrganization(
type=OrgType.PostAcuteCare,
name="Metriport Inc.",
location=Address(
addressLine1="2261 Market Street",
addressLine2="#4818",
city="San Francisco",
state=UsState.CA,
zip="94114",
country="USA",
)
));
```

## Async Client
Our Python SDK exports an async client that you can use with asyncio.

```python
from metriport import BaseOrganization, OrgType, Address, UsState
from metriport.client import AsyncMetriport

import asyncio

metriport_client = AsyncMetriport(api_key="YOUR_API_KEY")

async def create_organization():
document = metriport_client.medical.organization.create(BaseOrganization(
type=OrgType.PostAcuteCare,
name="Metriport Inc.",
location=Address(
addressLine1="2261 Market Street",
addressLine2="#4818",
city="San Francisco",
state=UsState.CA,
zip="94114",
country="USA",
)
));

asyncio.run(create_organization())
```

## Error Handling
All exceptions thrown by the SDK will sublcass [ApiError](./src/metriport/core/api_error.py).

```python
from metriport.core import ApiError
from metriport import BadRequestError

try:
metriport.medical.patients.get(patient_id='my_id')
except APIError as e:
# handle any api related error
```

## Timeouts
By default, the client is configured to have a timeout of 60 seconds. You can customize this value at client instantiation.

```python
from moneykit.client import MoneyKit

print(document)
metriport_client = Metriport(api_key="YOUR_API_KEY", timeout=15)
```

## Beta status
Expand Down

0 comments on commit a625376

Please sign in to comment.