Skip to main content

Client for NHS Digital 's MESH messaging system

Project description

MESH Client

A Python client for NHS Digital's MESH API.

Installation

pip install mesh_client

Example use

from mesh_client import MeshClient
client = MeshClient(
    'https://msg.dep.spine2.ncrs.nhs.uk',
    'MYMAILBOX',
    'Password123!'
    cert=('/etc/certs/cert.pem', '/etc/certs/key.pem'),  # Mesh uses SSL, so you'll need some certs
    verify='/etc/certs/mesh-ca-cert.pem')

client.handshake()  # It will work without this, but Spine will complain
message_ids = client.list_messages()
first_message = client.retrieve_message(message_ids[0])
print('Subject', first_message.subject)
print('Message', first_message.read())
first_message.acknowledge()

# Alternatively, iterate
for message in client.iterate_all_messages():
    with message: # With block will handle acknowledgement
        print('Message', message.read())

client.send_message('RECIPIENT_MAILBOX', b'Hello World!', subject='Important message')

Project details


Release history Release notifications

This version

0.9.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Mesh-Client, version 0.9.2
Filename, size File type Python version Upload date Hashes
Filename, size Mesh_Client-0.9.2-py2.py3-none-any.whl (29.3 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size Mesh Client-0.9.2.tar.gz (27.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page