A basic async Python interface for Mirth Connect
pip install mirth-client
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)