Skip to content

Basic Python interface for Mirth Connect

License

Notifications You must be signed in to change notification settings

renalreg/python-mirth-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-mirth-client

PyPI Release Documentation Status

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.

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.channels():
        metadata = await channel.get_info()
        print(f"ID: {metadata.id}")
        print(f"Name: {metadata.name}")
        print("")

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

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

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