Skip to main content

A simple API to send SMS messages.

Project description

A simple api to send SMS messages with django. The api is structured the same way as djangos own email api.

Installation

pip install django-sendsms

Configure the SENDSMS_BACKEND (defaults to 'sendsms.backends.console.SmsBackend'):

SENDSMS_BACKEND = 'myapp.mysmsbackend.SmsBackend'

Basic usage

Sending SMSs is like sending emails:

from sendsms import api
api.send_sms(body='I can haz txt', from_phone='+41791111111', to=['+41791234567'])

you can also make instances of SmsMessage:

from sendsms.message import SmsMessage
message = SmsMessage(body='lolcats make me hungry', from_phone='+41791111111', to=['+41791234567'])
message.send()

Custom backends

Creating custom SmsBackend s:

from sendsms.backends.base import BaseSmsBackend
from some.sms.delivery.api

class AwesomeSmsBackend(BaseSmsBackend):
    def send_messages(self, messages):
        for message in messages:
            for to in message.to:
                try:
                    some.sms.delivery.api.send(
                        message=message.body,
                        from_phone=message.from_phone,
                        to_phone=to,
                        flashing=message.flash
                    )
                except:
                    if not self.fail_silently:
                        raise

Then all you need to do is reference your backend in the SENDSMS_BACKEND setting.

Project details


Release history Release notifications | RSS feed

This version

0.3

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-sendsms-pebble-0.3.tar.gz (9.8 kB view details)

Uploaded Source

File details

Details for the file django-sendsms-pebble-0.3.tar.gz.

File metadata

File hashes

Hashes for django-sendsms-pebble-0.3.tar.gz
Algorithm Hash digest
SHA256 d0f8a104ea4b202c7b74a87223873df3f64651f0bdb8db4cb46811b9b7798809
MD5 f4205514feb84a40793ba2b4dcac9f0e
BLAKE2b-256 57247368d21d234a6a480ada3f7dcf7c70434d695d2b128104d50ddd1fb4d500

See more details on using hashes here.

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