Skip to main content

maacgo-sms · Python SDK

Taiwan-first SMS API. Send SMS in 3 lines of Python.

pip install maacgo-sms

Quickstart

from maacgo_sms import Maacgo

sms = Maacgo("sk_live_...")

r = sms.send(
    to="+886912345678",
    body="【你的品牌】驗證碼 123456,5 分鐘內有效。",
)
print(r["id"], r["status"])

Context manager

with Maacgo("sk_live_...") as sms:
    sms.send(to="+886912345678", body="...")

Batch send

sms.broadcast(
    name="週年慶",
    body="【你的品牌】週年慶 5 折起!",
    recipients=["+886912345678", "+886987654321"],
)

Errors

from maacgo_sms import Maacgo, MaacgoError

try:
    sms.send(to="09XXX", body="【...】Hi")
except MaacgoError as e:
    if e.data.get("error") == "ncc_blocked":
        print("NCC compliance failed:", e.data.get("issues"))
    elif e.data.get("error") == "insufficient_balance":
        print("Please top up")

Webhooks (Django / Flask / FastAPI)

import hmac, hashlib, os
from fastapi import FastAPI, Request, HTTPException

app = FastAPI()
SECRET = os.environ["CRESCLAB_WEBHOOK_SECRET"]

@app.post("/webhooks/cresclab")
async def webhook(request: Request):
    body = await request.body()
    sig = request.headers.get("x-cresclab-signature", "")
    expected = hmac.new(SECRET.encode(), body, hashlib.sha256).hexdigest()
    if not hmac.compare_digest(sig, expected):
        raise HTTPException(401)

    payload = await request.json()
    if payload["event"] == "sms.delivered":
        mark_delivered(payload["data"]["id"])
    return {"received": True}

License

MIT

Metadata

Release files for maacgo-sms 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 maacgo-sms 0.1.0
File Size Uploaded Provenance Actions
maacgo_sms-0.1.0.tar.gz 4.6 kB Without provenance Details for maacgo_sms-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for maacgo-sms 0.1.0
File Interpreter ABI Platform Actions
maacgo_sms-0.1.0-py3-none-any.whl Python 3 none any Details for maacgo_sms-0.1.0-py3-none-any.whl

Total release size: 9.5 kB

Release files / maacgo_sms-0.1.0.tar.gz

Download URL maacgo_sms-0.1.0.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
50fe4a256b8a019f1431d5d3e764b930bbd6e0ffa12c7fb36c21bd0cb63e7f3a
BLAKE2b-256 checksum
How to use checksums
0218f25ecb6b28a13e5e0d0a14b85be4c5a9b8611354f5cf7c04d1d8748d6b9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / maacgo_sms-0.1.0-py3-none-any.whl

Download URL maacgo_sms-0.1.0-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46c9b0dee2677f2d903bc88ee4668ed2810d78f6a2b31085e6707594cde76c87
BLAKE2b-256 checksum
How to use checksums
7ed3893a48bc39b8c0bf8b27167429c956c4986098b8b70ed3ad0b0259a3a3c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for maacgo-sms 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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