A Django app for sending SMS with interchangable backends.
Project description
A Django app for sending SMS with interchangable backends.
Requirements
Required
Python 2.5+
Django 1.2+
Backends
‘sms.backends.dummy.SMSBackend’
‘sms.backends.locmem.SMSBackend’
‘sms.backends.console.SMSBackend’
Writing a custom backend
You can write your own SMS backend by subclassing BaseSMSBackend and overriding the send_sms method.
class SMSBackend(BaseSMSBackend):
"""
My custom sms backend
"""
def __init__(self):
self.client = MyClient(settings.KEY, settings.SECRET)
def send_sms(self, message, from_, to):
self.client.send_message(message, from_, to)
Usage
Add an SMS backend to SMS_BACKEND in settings.py.
SMS_BACKEND = 'sms.backends.console.SMSBackend'
call send_sms
from sms import send_sms send_sms(text, from_, to)
Testing
sms.original_sms_backend = settings.SMS_BACKEND
settings.SMS_BACKEND = 'sms.backends.locmem.SMSBackend'
sms.outbox = []
sms.send_sms('my message', 'me', 'you')
self.assertIn('message', sms.outbox[0]['text'])
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-sms-0.0.2.tar.gz
(2.4 kB
view details)
File details
Details for the file django-sms-0.0.2.tar.gz.
File metadata
- Download URL: django-sms-0.0.2.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c74d32a3f191eeeb92e3976fb2f143c07542b31c8169365d9724771b13996232
|
|
| MD5 |
c871094ca522f61c40c58669d7301d00
|
|
| BLAKE2b-256 |
dbadd61bfbe2d1a763ba71b421f096064941554deeaa732fe42156e33e0f732d
|