Skip to main content

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

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.

Metadata

Release files for rafikisms-sdk 1.0.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 rafikisms-sdk 1.0.0
File Size Uploaded Provenance Actions
rafikisms_sdk-1.0.0.tar.gz 3.9 kB Without provenance Details for rafikisms_sdk-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rafikisms-sdk 1.0.0
File Interpreter ABI Platform Actions
rafikisms_sdk-1.0.0-py3-none-any.whl Python 3 none any Details for rafikisms_sdk-1.0.0-py3-none-any.whl

Total release size: 8.0 kB

Release files / rafikisms_sdk-1.0.0.tar.gz

Download URL rafikisms_sdk-1.0.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d2b787e21123789cba4bb2ffd7dc897e38ac2580a072e18a636347f5a5dcd1a3
BLAKE2b-256 checksum
How to use checksums
2e6a365dcb6538c0ce66d7be007b22af0f118d36f3250f253acae9e79afb0f28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / rafikisms_sdk-1.0.0-py3-none-any.whl

Download URL rafikisms_sdk-1.0.0-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91da83af7dd3beabd5dff079652227a04d1af3bd78f78cdaccd23bdfde4bc0cd
BLAKE2b-256 checksum
How to use checksums
c678ccf259b96cc6bf8cd2a9ba5c82372472257398a54614470d36139a8495da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for rafikisms-sdk 1.0.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

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