Metadata-Version: 2.1
Name: mirth-client
Version: 2.0.3
Summary: Basic Python interface for Mirth Connect
Author: Joel Collins
Author-email: joel.collins@renalregistry.nhs.uk
Requires-Python: >=3.6.2,<4.0.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Provides-Extra: docs
Requires-Dist: Sphinx (>=3.5.3,<5.0.0); extra == "docs"
Requires-Dist: httpx (>=0.18,<0.20)
Requires-Dist: pydantic (>=1.8.2,<2.0.0)
Requires-Dist: semver (>=2.13.0,<3.0.0)
Requires-Dist: sphinx-rtd-theme (>=0.5.1,<0.6.0); extra == "docs"
Requires-Dist: typing-extensions (>=3.10.0,<4.0.0)
Requires-Dist: xmltodict (>=0.12.0,<0.13.0)
Description-Content-Type: text/markdown

# python-mirth-client

[![PyPI Release](https://img.shields.io/pypi/v/mirth-client)](https://pypi.org/project/mirth-client/)
[![Documentation Status](https://readthedocs.org/projects/python-mirth-client/badge/?version=latest)](https://python-mirth-client.readthedocs.io/en/latest/?badge=latest)

A basic async Python interface for Mirth Connect

## Installation

`pip install mirth-client`

## Usage example

Assuming running within IPython or as part of an async application with an event-loop set up.

```python
from mirth_client import MirthAPI
from pprint import pprint

async with MirthAPI("https://mirth.domain.com/api") as api:
    await api.login("****", "****")

    # Check out list of channels
    for channel in await api.get_channels():
        metadata = await channel.get()
        print(f"ID: {metadata.id}")
        print(f"Name: {metadata.name}")
        print("")

    # Get stats for a channel
    s = await channels["3cdefad2-bf10-49ee-81c9-8ac6fd2fed67"].get_statistics()
    pprint(s)

    # Check channel for failed messages
    e = await channels["3cdefad2-bf10-49ee-81c9-8ac6fd2fed67"].get_messages(status="error")
    pprint(e)

    # Get 10 most recent events
    e = await api.get_events(10)
    pprint(e)
```

