Termii-py
Super easy SDK for Termii SMS APIs.
Installation
Install using pip install -U termii-py.
Simple Examples
from termii.token import Token
from termii.schemas.token import TokenType
token_client = Token()
token_client.authenticate_from_env()
response = token_client.send_token(
message_type=TokenType.ALPHANUMERIC,
receiver="2348152436475",
)
print(response)
from termii.messaging import Messaging
messaging_client = Messaging()
messaging_client.authenticate_from_env()
receivers = ["2348152436475", "2347153436435"]
response = messaging_client.send_message(
receivers=receivers,
text="Hello all. Thanks for visiting."
)
print(response)
from termii.campaign import Campaign
campaign_client = Campaign()
campaign_client.authenticate_from_env()
response = campaign_client.create_phonebook(
name="Test", description="Test description."
)
print(response)
Authentication.
There are two ways of authenticating requests:
- With env variables:
To authenticate with environment variables set
TERMII_API_KEY,TERMII_ENDPOINT_URL,TERMII_SENDER_IDto your termii api key, endpoint url and sender ID respectively. Then call client.authenticate_from_env()
Example:
import os
from termii.campaign import Campaign
os.environ["TERMII_API_KEY"] = "ukwiwe4642eh"
os.environ["TERMII_ENDPOINT_URL"] = "https://api.ng.termii.com"
os.environ["TERMII_SENDER_ID"] = "Test"
campaign_client = Campaign()
campaign_client.authenticate_from_env()
- A second method is to pass in the credentials directly. For that call
authenticate_direct()on all clients and pass-in the credentials.
Contributing
For guidance on setting up a development environment and how to make a contribution to termii-py, see Contributing to Termii-py.
Reporting a Security Vulnerability
Security vulnerabilities are a serious concern. If you discover a potential security issue, please do not create a public issue report. Instead, use the confidential reporting feature provided by GitHub, ensuring the details remain private until a fix is released. You can find instructions on privately reporting vulnerabilities here: Privately reporting a security vulnerability
Release files for termii-py 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| termii_py-0.1.7.tar.gz | 20.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| termii_py-0.1.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:35.1 kB
Release files / termii_py-0.1.7.tar.gz
| Download URL | termii_py-0.1.7.tar.gz |
|---|---|
| Size | 20.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
139a8e036cb49513d16155f74c90f6626060c1dffdab6114016f0b3ef7bd8a2f
|
|
BLAKE2b-256 checksum How to use checksums |
4688b900e443c59a4ed8585fb46c2672310e03dae3f6ba8321a3348276353f4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.8
|
Release files / termii_py-0.1.7-py3-none-any.whl
| Download URL | termii_py-0.1.7-py3-none-any.whl |
|---|---|
| Size | 14.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4a900f69cd5b5bc3b2847099af74d368ff8a161434639f62b3bc8ca609d751e9
|
|
BLAKE2b-256 checksum How to use checksums |
f1c14bfe88fac7f13a1b5de6f40e0ba398e3da7985d91ba19042f48064f18d38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.8
|