Django Anexia SMS Gateway
A django module to send short messages via the Anexia SMS gateway (ASGW). It requires an active Anexia Engine subscription and a "ready to use" configured " sender" within your web service.
Installation
Install using pip:
pip install django-anexia-sms-gateway
In the project's settings.py add the access token configuration:
# Anexia SMS Gateway settings (ASGW)
ASGW_ACTIVE = True
ASGW_API_TOKEN = "your-asgw-api-token"
Usage
Call the send_sms method wherever you want to trigger a short message:
from django_anexia_sms_gateway.sms import send_sms
send_sms(message="SMS content", destination="+43123456789")
Translation (message)
If you provide a translatable message string be sure to use ugettext ("gettext_lazy" would not be triggered on time):
from django.utils.translation import ugettext
from django_anexia_sms_gateway.sms import send_sms
send_sms(message=ugettext("Translatable SMS content"), destination="+43123456789")
Recipient phone number (destination)
The recipient's phone number (=destination) must consist of prefix + followed by 1 to 14 digits. Otherwise the ASGW
API will return an error.
Phone number on model
In case you store the phone number on a model (e.g. User), we recommend direct validation via RegexValidator, e.g.:
from django.core.validators import RegexValidator
from django.db.models import CharField
from django.utils.translation import gettext_lazy as _
phone = CharField(
_("phone number"),
max_length=15,
blank=True,
help_text=_("Prefix '+' followed by 1-14 digits, e.g. '+436641234'"),
validators=[
RegexValidator(
r"^\+\d{1,14}$",
_("Phone number must be entered in the format: '+123456789'. Prefix '+' with 1 to 14 digits allowed."),
)
],
)
Metadata
Release files for django-anexia-sms-gateway 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_anexia_sms_gateway-1.2.0.tar.gz | 9.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_anexia_sms_gateway-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.5 kB
Release files / django_anexia_sms_gateway-1.2.0.tar.gz
| Download URL | django_anexia_sms_gateway-1.2.0.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f136c579dc62aa55de1b9402db00949e11aeef6146e29db01628646143072d3a
|
|
BLAKE2b-256 checksum How to use checksums |
d4cdd269918c3c495e11ff3545c1df23893d9833704bcdfcbd23accd17a210ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / django_anexia_sms_gateway-1.2.0-py3-none-any.whl
| Download URL | django_anexia_sms_gateway-1.2.0-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3c4ea0d55772beb5f93f3903704e94f689815d7a3989b82c95120d5026a6e6c7
|
|
BLAKE2b-256 checksum How to use checksums |
50bffec90fa441ede24e4e5816029726f69fa0a4f9eaadf866c6ec721da6962b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|