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
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-0.2.tar.gz
(7.8 kB
view details)
File details
Details for the file django-sendsms-0.2.tar.gz
.
File metadata
- Download URL: django-sendsms-0.2.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78529bf6772ce18881daa810f0e2ab72a0187d0ffe766ed7a67682a5433e6454 |
|
MD5 | d0bbef99d348e9175dcf02c4b6d11cc2 |
|
BLAKE2b-256 | cfb76d1341fb021011a48f7516179164a16e437e9c7d1f846e96d0bc1ead3a7b |