Skip to main content

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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for subitosms-sdk 0.1.0
File Size Uploaded
subitosms_sdk-0.1.0.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for subitosms-sdk 0.1.0
File Interpreter ABI Platform
subitosms_sdk-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.3 kB

Release files / subitosms_sdk-0.1.0.tar.gz

Download URL subitosms_sdk-0.1.0.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c63a44f1d3d8de0c02e316583150e07d69845c44a12392f4cdfcfdb5a3a7a982
BLAKE2b-256 checksum
How to use checksums
fc7a36397cbe9621d4cc4cbfd797bacefa1a9800053b9a4838ec13b2e3b70d6e
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.0-py3-none-any.whl

Download URL subitosms_sdk-0.1.0-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
18e6adadd04274084b07e89c93c134abeac463cac4b40e672437612fd2ea0c6f
BLAKE2b-256 checksum
How to use checksums
92776cd8c095c92ddef52d70f508ea43b434f957f4cd7aa439506abd9977afe3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release history Release notifications | RSS feed

0.1.1

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page