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, NHS_DEP_ENDPOINT
with MeshClient(
          NHS_DEP_ENDPOINT,
          'MYMAILBOX',
          'Password123!',
          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')

Guidance for contributors

You should be doing all your development in a virtualenv / venv. You can install everything you need for development with

virtualenv .venv
source .venv/bin/activate
pip install -r dev-requirements.txt
pip install -e .

# if using asdf
pip install tox-asdf

We use unittest for tests, and you can run the test suite locally with:

python -m unittest discover . '*_test.py'

We use tox for testing on multiple versions. To run the tox tests, just run:

tox

For releases, we use twine. The rough release process would be:

tox  # Re-run tests, just to be sure
git tag $CURRENT_VERSION
rm dist/*  # Get rid of previous distribution files
python -m build
twine upload -r testpypi dist/*
# Check artifacts are uploaded correctly, and that entry on PyPI looks correct
twine upload dist/*
git push --tags

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-1.5.2.tar.gz (53.5 kB view details)

Uploaded Source

Built Distribution

Mesh_Client-1.5.2-py2.py3-none-any.whl (51.5 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

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

File hashes

Hashes for Mesh Client-1.5.2.tar.gz
Algorithm Hash digest
SHA256 cbc5c79567e264ae07873462437a84e050e6cf90b446afb4051d68a00f32b972
MD5 076981de53f045c5b1a1e909c1d840f7
BLAKE2b-256 30e21a4f5f8d50eb6801b336b4168eb3aa3a68637601ca9d06dd4e23dc6665bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Mesh_Client-1.5.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ea5b1926914c5cc987dac81af1a30fa815be8bc2c5f85ca9ccd1ff2a4b1a855a
MD5 636ea25f2375bfe65531949625bf538c
BLAKE2b-256 873bd6780fcb5825d908d2cd3460f42a8eacab808d042efdfb3ad936ff1f1466

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