Python SDK for the Platform5 Developer API — send SMS, email, and more
Project description
platform5-sdk
Python SDK for the Platform5 Developer API.
Install
pip install platform5-sdk
Usage
from platform5 import Platform5
client = Platform5(api_key="p5_live_abc123def456")
# Send an SMS
resp = client.sms.send(
to="+254712345678",
message="Your appointment is confirmed for tomorrow at 10 AM.",
from_="MyBrand",
)
print(resp.message_id, resp.parts, resp.cost)
# Send an email
client.email.send(
to="user@example.com",
subject="Welcome to Platform5",
body="Hello, thank you for signing up!",
from_="MyBrand",
)
# Check message status
status = client.messages.get("msg-uuid")
print(status.status)
# Check balance
balance = client.account.get_balance()
print(balance.available_balance, balance.currency)
Configuration
Platform5(
api_key="p5_live_abc123",
base_url="http://localhost:8084", # optional, defaults to http://localhost:8084
)
Services
| Method | Endpoint |
|---|---|
client.sms.send(to, message, from_) |
POST /v1/sms/send |
client.email.send(to, subject, body, from_, body_type?) |
POST /v1/email/send |
client.messages.get(id) |
GET /v1/messages/{id} |
client.account.get_balance() |
GET /v1/balance |
client.health() |
GET /health |
Error Handling
from platform5.errors import (
UnauthorizedError,
InsufficientBalanceError,
ForbiddenError,
NotFoundError,
ValidationError,
RateLimitError,
Platform5Error,
)
try:
client.sms.send(to="+2547", message="Hello", from_="MyBrand")
except RateLimitError as e:
print(f"Rate limited: {e.remaining}/{e.limit}")
except Platform5Error as e:
print(f"API error {e.status_code}: {e}")
Idempotency
sms.send() and email.send() automatically generate a UUID Idempotency-Key header for every request.
Requirements
- Python 3.10+
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file platform5_sdk-0.1.0.tar.gz.
File metadata
- Download URL: platform5_sdk-0.1.0.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a62c00fb5c4d4fe62ef83f19a626d9e78c56586f21628dec81f7fdf760154f00
|
|
| MD5 |
a959b6be7e06ca7896ae7d8749c83872
|
|
| BLAKE2b-256 |
32024198239d835ce8c88908d382ada328c4a8cfd44fd909e270c681ab114c66
|
Provenance
The following attestation bundles were made for platform5_sdk-0.1.0.tar.gz:
Publisher:
release.yml on nixoncode/platform5-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
platform5_sdk-0.1.0.tar.gz -
Subject digest:
a62c00fb5c4d4fe62ef83f19a626d9e78c56586f21628dec81f7fdf760154f00 - Sigstore transparency entry: 2167198211
- Sigstore integration time:
-
Permalink:
nixoncode/platform5-sdk-python@2f030a17a6daf22883482d0ec95c33d9472f94ea -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/nixoncode
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2f030a17a6daf22883482d0ec95c33d9472f94ea -
Trigger Event:
push
-
Statement type:
File details
Details for the file platform5_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: platform5_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf49fffa9cf87d3233665c9a3e93da87c13b4e31d09341d80f5e109e77b231c2
|
|
| MD5 |
9849cf74fb4220a75364784aeab2c28c
|
|
| BLAKE2b-256 |
42af27ac967fcf81530626637b6e5c9bc353a77b6f48008b71e1f4cb12be8951
|
Provenance
The following attestation bundles were made for platform5_sdk-0.1.0-py3-none-any.whl:
Publisher:
release.yml on nixoncode/platform5-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
platform5_sdk-0.1.0-py3-none-any.whl -
Subject digest:
bf49fffa9cf87d3233665c9a3e93da87c13b4e31d09341d80f5e109e77b231c2 - Sigstore transparency entry: 2167198225
- Sigstore integration time:
-
Permalink:
nixoncode/platform5-sdk-python@2f030a17a6daf22883482d0ec95c33d9472f94ea -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/nixoncode
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2f030a17a6daf22883482d0ec95c33d9472f94ea -
Trigger Event:
push
-
Statement type: