HTTP client for Rafiki SMS vendor API (X-API-Key)
Project description
Rafikisms Python SDK
HTTP client for the Rafiki SMS vendor API (X-API-Key), aligned with sdk/js and sdk/php.
Developer docs: https://developers.rafikisms.com/
OpenAPI JSON: https://developers.rafikisms.com/v1/docs/openapi.json
Requirements
- Python 3.10+
- httpx
Install (local path)
From another project:
pip install -e ../path/to/rafikisms/sdk/python
Or add to pyproject.toml:
dependencies = [
"rafikisms-sdk @ file:///${PROJECT_ROOT}/sdk/python",
]
Usage
import os
from rafikisms import Client
with Client("https://api.rafikisms.com", os.environ["RAFIKISMS_API_KEY"]) as c:
r = c.get_balance()
if r.success:
print(r.data["credit_balance"])
OTP
otp = c.generate_otp({"phone_number": "255712345678", "sender_id": "MYBRAND"})
verified = c.verify_otp({
"phone_number": "255712345678",
"otp_code": "482916",
"reference_id": otp.data["reference_id"],
})
Strict errors
from rafikisms import ApiError, Client
c = Client(base_url, api_key, throw_on_error=True)
try:
c.send_sms({"phone": "255712345678", "message": "Hi"})
except ApiError as e:
print(e.result.error_code, e.result.errors)
API
| Method | HTTP |
|---|---|
send_sms |
POST /v1/vendor/send-sms |
send_bulk_sms |
POST /v1/vendor/send-bulk-sms |
generate_otp |
POST /v1/otp/generate |
verify_otp |
POST /v1/otp/verify |
get_balance |
GET /v1/vendor/balance |
get_sms_logs |
GET /v1/vendor/sms-logs |
get_delivery_report |
GET /v1/vendor/delivery-reports |
get_sender_names |
GET /v1/vendor/sender-names |
request_sender_name |
POST /v1/sender-names/request |
update_delivery_webhook |
PUT /v1/vendors/delivery-webhook |
Tests
cd sdk/python && pip install -e ".[dev]" && pytest -q
License
MIT.
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 rafikisms_sdk-1.0.0.tar.gz.
File metadata
- Download URL: rafikisms_sdk-1.0.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2b787e21123789cba4bb2ffd7dc897e38ac2580a072e18a636347f5a5dcd1a3
|
|
| MD5 |
28e230767ca1c4e3a1acf448a0bef978
|
|
| BLAKE2b-256 |
2e6a365dcb6538c0ce66d7be007b22af0f118d36f3250f253acae9e79afb0f28
|
File details
Details for the file rafikisms_sdk-1.0.0-py3-none-any.whl.
File metadata
- Download URL: rafikisms_sdk-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91da83af7dd3beabd5dff079652227a04d1af3bd78f78cdaccd23bdfde4bc0cd
|
|
| MD5 |
6de85ff224c43d70a8d013e78bea0567
|
|
| BLAKE2b-256 |
c678ccf259b96cc6bf8cd2a9ba5c82372472257398a54614470d36139a8495da
|