Termii Python Library for Termii API
Project description
termiipython
Termii Python Library for Termii API
Installation
pip install termiipython
Usage
from termiipython.token import Token
from termiipython.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 termiipython.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 termiipython.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 termiipython.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
Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.
License
termiipython
was created by Solomon Olatunji. It is licensed under the terms of the MIT license.
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
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
File details
Details for the file termiipython-3.1.0.tar.gz
.
File metadata
- Download URL: termiipython-3.1.0.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.0 CPython/3.11.2 Linux/6.2.0-37-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67b5f803ba350441059c64d3b1a19175a722974cb08088dbfafb1feda2c39483 |
|
MD5 | efbe4177fccd851d36f90e47fd9f15f9 |
|
BLAKE2b-256 | c43375e2e4736858fcf0f51f4dd0f41ba4d5f7d9c6597bbc0782caf02c989073 |
File details
Details for the file termiipython-3.1.0-py3-none-any.whl
.
File metadata
- Download URL: termiipython-3.1.0-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.0 CPython/3.11.2 Linux/6.2.0-37-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d43dde20588f5a71f2052c2a44b0d0514096861eaff84071a7c81d3ccb640be9 |
|
MD5 | bf63d7c1fcda1c90041110db6942f23b |
|
BLAKE2b-256 | 69ab4e78a72a51d456ccb14d01c6300080d7c672a5389e8180c697036d6ff9eb |