Metadata-Version: 2.1
Name: Mesh-Client
Version: 2.1.2
Summary: Client for NHS England's MESH messaging system
Home-page: https://github.com/NHSDigital/mesh-client
Author: spinecore
License: MIT
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE

MESH Client
===========

A Python client for [NHS Digital's MESH API](https://digital.nhs.uk/developer/api-catalogue/message-exchange-for-social-care-and-health-api).

Installation
------------

```bash
pip install mesh-client
```

Example use
-----------

```python
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](https://github.com/NHSDigital/mesh-sandbox) 
have a look at this [docker-compose.yml](docker-compose.yml) for an example of how to run the sandbox


Guidance for contributors
-------------------------

see [CONTRIBUTING](CONTRIBUTING.md)

