A Django app to send sms with skebby
Project description
django-skebby
===================
A simple Django app to send sms by Skebby.
Usage
-----
In settings.py:
SKEBBY_USERNAME = 'yourskebbyusername'
SKEBBY_PASSWORD = 'yourskebbypassword'
# if SSL does not work
#SKEBBY_URL = "http://gateway.skebby.it/api/send/smseasy/advanced/http.php"
# If you have *requested and obtained* the raise to 100000 messages per request
#SKEBBY_MAX_RECIPIENTS = 100000
# default method is classic
SKEBBY_DEFAULT_METHOD = "basic"
In your code:
from django_skebby.utils import Sms, skebby_credit_left
# greetings to some people
template = "Good {{ festivity }}{% if friend %} {{ friend }}{% endif %}!"
ctx = {'festivity': 'birthday'}
sms = Sms(template, ["39123456789", "3912346788"], sender_string="Your friend", ctx=ctx)
ret = sms.send()
# Skebby has a recipient limit of 50000 numbers that can be raised to 100000 on request
# The app will take care of itself depending on settings.SKEBBY_MAX_RECIPIENTS
failed_requests = [r for r in ret if r.skebby_error]
if failed_requests:
print "some errors!"
# to a special friend
ctx = {'festivity': birthday, 'friend': 'Doge'}
r = sms.send_single(ctx, "3912345679")
if r.skebby_error:
print "failed to greet :( %s" % (r.skebby_response)
# check credit
credit = skebby_credit_left()
if credit.skebby_error:
print "failed to get credit"
else:
print credit.skebby_response
A view that returns the credit in json format is available, to enable it add the app:
INSTALLED_APPS = (
...
'django_skebby',
)
include the urls:
url(r'^skebby/', include('django_skebby.urls')),
add use it:
<script>
$.get('/skebby/credit_left/', function(data) {
console.log(data['credit_left']);
console.log(data['classic_sms']);
console.log(data['basic_sms']);
});
</script>
===================
A simple Django app to send sms by Skebby.
Usage
-----
In settings.py:
SKEBBY_USERNAME = 'yourskebbyusername'
SKEBBY_PASSWORD = 'yourskebbypassword'
# if SSL does not work
#SKEBBY_URL = "http://gateway.skebby.it/api/send/smseasy/advanced/http.php"
# If you have *requested and obtained* the raise to 100000 messages per request
#SKEBBY_MAX_RECIPIENTS = 100000
# default method is classic
SKEBBY_DEFAULT_METHOD = "basic"
In your code:
from django_skebby.utils import Sms, skebby_credit_left
# greetings to some people
template = "Good {{ festivity }}{% if friend %} {{ friend }}{% endif %}!"
ctx = {'festivity': 'birthday'}
sms = Sms(template, ["39123456789", "3912346788"], sender_string="Your friend", ctx=ctx)
ret = sms.send()
# Skebby has a recipient limit of 50000 numbers that can be raised to 100000 on request
# The app will take care of itself depending on settings.SKEBBY_MAX_RECIPIENTS
failed_requests = [r for r in ret if r.skebby_error]
if failed_requests:
print "some errors!"
# to a special friend
ctx = {'festivity': birthday, 'friend': 'Doge'}
r = sms.send_single(ctx, "3912345679")
if r.skebby_error:
print "failed to greet :( %s" % (r.skebby_response)
# check credit
credit = skebby_credit_left()
if credit.skebby_error:
print "failed to get credit"
else:
print credit.skebby_response
A view that returns the credit in json format is available, to enable it add the app:
INSTALLED_APPS = (
...
'django_skebby',
)
include the urls:
url(r'^skebby/', include('django_skebby.urls')),
add use it:
<script>
$.get('/skebby/credit_left/', function(data) {
console.log(data['credit_left']);
console.log(data['classic_sms']);
console.log(data['basic_sms']);
});
</script>
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django-skebby-0.3.0.tar.gz
(5.4 kB
view details)
File details
Details for the file django-skebby-0.3.0.tar.gz
.
File metadata
- Download URL: django-skebby-0.3.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a67005acd43a331fffc16a5a85a39a43182b0b832fea0effc2c634776f8856dc |
|
MD5 | 3f844136408c5c996aeb29d83c3d0476 |
|
BLAKE2b-256 | 5a60310c270578fbb835e6b64677863ae0ece60345e9a8419001662394cccd47 |