Skip to main content

a simple sdk to send notifications on queue for celery tasks

Project description

Kaftar SDK

Usage

Package installation

pip install kaftar

Usage:

import uuid
import time
from kaftar import Notification

message_uuid = uuid.uuid4()
group_uuid = uuid.uuid4()
broker_url = "BROKER_URL_HERE"

app = Notification('app_name', broker_url)
app.send_notification(
    {
        'subject': 'Notification title goes here',
        'content': 'Notification body goes here'
    },
    [
        {
            'receiver': "076f08cc-4122-400a-bffa-2a0157ba57eb",  # can be email or phone number
            'message_uuid': str(message_uuid),  # Optional (task will generate an id if not provided here)
            'uuid': "076f08cc-4122-400a-bffa-2a0157ba57eb"
        }
    ],
    int(time.time()),
    group_uuid=group_uuid # Optional
)
# Delete single notification
app.delete_notification(message_uuid)

# Delete group of notifications
app.delete_group_notification(group_uuid)

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

kaftar-0.2.tar.gz (2.3 kB view hashes)

Uploaded Source

Built Distribution

kaftar-0.2-py3-none-any.whl (2.6 kB view hashes)

Uploaded Python 3

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