Skip to main content
https://coveralls.io/repos/github/stefanfoulis/django-sendsms/badge.svg?branch=master https://github.com/stefanfoulis/django-sendsms/workflows/Django%20Send%20SMS%20Build/badge.svg?branch=master https://badge.fury.io/py/django-sendsms.svg

A simple api to send SMS messages with django. The api is structured the same way as Django’s 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
import 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.

Running tests

python setup.py test

Or better, install and run “tox”.

Contributing

Pull requests are very welcome. Please make sure code is formatted using black and isort.

Release files for django-sendsms 0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-sendsms 0.5
File Size Uploaded
django-sendsms-0.5.tar.gz 16.2 kB Details

Release files / django-sendsms-0.5.tar.gz

Download URL django-sendsms-0.5.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
67bd5cb2c5fc3034424de1883f9a9ed18e60ee7ca94907a27cca8a6ebb57c2d9
BLAKE2b-256 checksum
How to use checksums
6136dfdfd607a63c4454dcbaad540b21370a4eb8f7fce07167a88e1664de67d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

Release history Release notifications | RSS feed

This release

0.5 This release

1 release file

0.4

1 release file

0.3.1

1 release file

0.3

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page