A beginner friendly SDK for Termii.
Project description
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_ID
to 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
Please send a private mail to lordunyime@gmail.com
if you discover any security vulnerability. I'll be happy to work with you on a fix.
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
termii_py-0.1.3.tar.gz
(20.2 kB
view hashes)
Built Distribution
termii_py-0.1.3-py3-none-any.whl
(14.7 kB
view hashes)
Close
Hashes for termii_py-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de2f079128d3bdc2dc3f8183694f3e0331791854f56283578005041a8c47be1b |
|
MD5 | a650b3890a0292ad1569038a17374549 |
|
BLAKE2b-256 | a1b0cf5ea9acc218d3484dc567c168d3189dfd1db448955190d82f6cf4b58071 |