SubitoSMS per Python
Client Python leggero e senza dipendenze per il gateway HTTP di SubitoSMS.
Installazione
pip install subitosms-sdk
Invio di un SMS
from subitosms import Client
sms = Client("la-tua-username", "la-tua-password")
shipment_id = sms.send("MIOBRAND", "+393351234567", "Ciao da SubitoSMS!")
print(f"Spedizione: {shipment_id}")
Più destinatari, invio di prova e ritardato
shipment_id = sms.send(
"MIOBRAND",
["+393351234567", "+393331234567"],
"Promemoria appuntamento domani alle 10:00.",
test=True,
delay_minutes=15,
)
Credito e stato della spedizione
credit = sms.balance()
credit_with_foreign = sms.balance(include_foreign=True)
for delivery in sms.status(shipment_id):
print(delivery.destination, delivery.status, delivery.description)
Gestione degli errori
from subitosms import ApiError, TransportError
try:
sms.send("MIOBRAND", "+393351234567", "Ciao")
except TransportError:
# Problema di rete/HTTPS: l'invio potrebbe essere arrivato al gateway.
pass
except ApiError:
# Risposta del gateway non valida o non accettata.
pass
Non ritentare automaticamente un invio quando non sai se il gateway lo abbia ricevuto: potresti inviare un SMS duplicato. Conserva l'ID della spedizione e usa status() o la callback per seguirne la consegna.
Licenza
MIT. Vedi LICENSE.
Release files for subitosms-sdk 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| subitosms_sdk-0.1.1.tar.gz | 5.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| subitosms_sdk-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.3 kB
Release files / subitosms_sdk-0.1.1.tar.gz
| Download URL | subitosms_sdk-0.1.1.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f3d6c7a9dab46b08c9dad70d6fcb67fd4f27ea242f5e60ac70c2349a8ca4ab51
|
|
BLAKE2b-256 checksum How to use checksums |
bb6f71921a73af3354c5a3c2072f186863861628cbcbea269670972ba60298ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / subitosms_sdk-0.1.1-py3-none-any.whl
| Download URL | subitosms_sdk-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fde0a62e4ab7f3c8942b5b7fe34a3d1fee33f01bb5ef9ed8bfccd193f7fdd97b
|
|
BLAKE2b-256 checksum How to use checksums |
59be5b5eacfefa58d69b8ccdccd53360dece0cc5202e5dd967a2608d0f2c7620
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|