The `notifications-python-client` is the official Python API client for GOV.UK Notify, a service that allows government departments to send emails, SMS messages, and letters to their users. It is actively maintained by the Government Digital Service (GDS), with version 10.0.1 being the latest stable release, reflecting ongoing development and adherence to GOV.UK standards.
pip install notifications-python-clientVerified import paths — ran on the pinned version, not inferred.
Demonstrates sending an email notification using the GOV.UK Notify client, including how to handle API keys from environment variables and basic error handling. Remember to replace `YOUR_EMAIL_TEMPLATE_ID` with a valid ID from your Notify service.
Generate a new API key from the GOV.UK Notify admin interface. If this is not possible, ensure your client version matches the key format or adjust your API key implementation.
Ensure your `base_url` is explicitly configured for non-production environments (e.g., staging). Review your `requests` dependency if you encounter version conflicts.
Initialize the client with `client = NotificationsAPIClient(api_key=your_key, base_url='https://api.staging.notifications.service.gov.uk')` for non-production usage.
Verify the API key is correct and active in the GOV.UK Notify admin interface. If your key is old, generate a new one. Ensure no whitespace or typos.
Use a 'live' API key (if your service is approved) or ensure the recipient is added to your team members in GOV.UK Notify for testing with a 'team-only' key. Verify your service status in Notify admin.
Double-check the `template_id` in your GOV.UK Notify account and ensure it belongs to the correct service that the API key is linked to.
No dependency data recorded yet.