Skip to main content

Client for NHS England'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, NHS_DEP_ENDPOINT
with MeshClient(
          NHS_DEP_ENDPOINT,
          'MYMAILBOX',
          'Password',
          cert=('/etc/certs/cert.pem', '/etc/certs/key.pem')  # Mesh uses SSL, so you'll need some certs
        ) as client:

    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')

Testing your application

We recommend using the mesh sandbox have a look at this docker-compose.yml for an example of how to run the sandbox

Guidance for contributors

see CONTRIBUTING

Project details


Download files

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

Source Distribution

Mesh-Client-2.0.1.tar.gz (93.0 kB view details)

Uploaded Source

Built Distribution

Mesh_Client-2.0.1-py2.py3-none-any.whl (33.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file Mesh-Client-2.0.1.tar.gz.

File metadata

  • Download URL: Mesh-Client-2.0.1.tar.gz
  • Upload date:
  • Size: 93.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for Mesh-Client-2.0.1.tar.gz
Algorithm Hash digest
SHA256 33ae77b5e8632bd5b9fddcc685c39967c4bda95a5a4bdeb787cac652a9579983
MD5 ac01ad90cb4207b07eaf3e687ca8725c
BLAKE2b-256 463b02edf0210c5029491afcbf2e277f80df8e911f037b8c12e30a82fe06a79e

See more details on using hashes here.

File details

Details for the file Mesh_Client-2.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for Mesh_Client-2.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5003242077c1409b1d499a13b2eb2421691a5650dad8acf4b1bff802de369bbe
MD5 eec48613c6fc120c0268f9b7e24b1ce4
BLAKE2b-256 d2ac593e6aa6419979ee8215d28514db0f17e7bd6aabd2114d0da9eb2d45b0af

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page