Quickstart

Requirements

Python

  • Python 2.7+
  • Python 3.4+
  • PyPy
  • PyPy3

Supported Frameworks

  • Django 1.8
  • Django 1.11
  • Django 2.0

Installation

Install kawasemi with your favorite package manager:

pip install kawasemi

Note: Please use the latest version of setuptools, pip, and wheel.

pip install -U setuptools pip wheel

Configurations

You can write the configuration of kawasemi with a dictionary object.

  • If you want to send notifications to HipChat:

    config = {
        "CHANNELS": {
            "hipchat": {
                "_backend": "kawasemi.backends.hipchat.HipChatChannel",
                "api_id": "1234567",
                "token": "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
            }
        }
    }
    
  • You can use one or more channels. To send notifications to both HipChat and Slack:

    config = {
        "CHANNELS": {
            "hipchat": {
               "_backend": "kawasemi.backends.hipchat.HipChatChannel",
                "api_id": "1234567",
                "token": "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
            },
            "slack": {
                "_backend": "kawasemi.backends.slack.SlackChannel",
                "url": "https://hooks.slack.com/services/ABCDEF/GHIJKLM/1234567890"
            }
        }
    }
    
  • Of course, you can send a message to two different rooms simultaneously. To send notifications to two different HipChat rooms:

    config = {
        "CHANNELS": {
            "hipchat_first": {
               "_backend": "kawasemi.backends.hipchat.HipChatChannel",
                "api_id": "1234567",
                "token": "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
            },
            "hipchat_second": {
               "_backend": "kawasemi.backends.hipchat.HipChatChannel",
                "api_id": "3456789",
                "token": "abcdefghijklmnopqrstuvwxyz0987654321"
            }
        }
    }
    

Usage

You can send notifications with a following simple code:

from kawasemi import Kawasemi

config = {
    "CHANNELS": {
        "hipchat": {
            "_backend": "kawasemi.backends.hipchat.HipChatChannel",
            "api_id": "1234567",
            "token": "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
        }
    }
}
kawasemi = Kawasemi(config)
kawasemi.send("Sample notification.")
kawasemi.send("Another notification.")

Integration with Django

You can load configurations of kawasemi from settings.py by using this integration.

  1. Add 'kawasemi' to your INSTALLED_APPS setting:
INSTALLED_APPS = [
    # Other apps
    'kawasemi.django',
]
  1. Add KAWASEMI to your project settings. You must obtain API keys or tokens from each service.
KAWASEMI = {
    "CHANNELS": {
        "hipchat": {
            "_backend": "kawasemi.backends.hipchat.HipChatChannel",
            "api_id": "1234567",
            "token": "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
        }
    }
}
  1. You can send notifications with a following simple code:
from kawasemi.django import send

send("Sample notification.")