https://github.com/nhsdigital/mesh-client
A Python client library for NHS Digital MESH
https://github.com/nhsdigital/mesh-client
Last synced: 4 months ago
JSON representation
A Python client library for NHS Digital MESH
- Host: GitHub
- URL: https://github.com/nhsdigital/mesh-client
- Owner: NHSDigital
- License: mit
- Created: 2020-05-15T15:30:35.000Z (over 5 years ago)
- Default Branch: develop
- Last Pushed: 2024-02-13T12:47:27.000Z (almost 2 years ago)
- Last Synced: 2024-04-13T07:14:19.458Z (almost 2 years ago)
- Language: Python
- Homepage:
- Size: 504 KB
- Stars: 9
- Watchers: 5
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGE-LOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
MESH Client
===========
A Python client for [NHS England's MESH API](https://digital.nhs.uk/developer/api-catalogue/message-exchange-for-social-care-and-health-api).
Release Notes
------------
see [CHANGE-LOG](CHANGE-LOG.md) for news on major changes
Installation
------------
```bash
pip install mesh-client
```
Example use
-----------
```python
from mesh_client import MeshClient, INT_ENDPOINT
# or LIVE_ENDPOINT
with MeshClient(
INT_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)