Client for SMSAPI.
Compatible with Python 2.7+, 3.+.
requests
If You have pip installed:
sudo pip install smsapi-client
else You can install manually:
git clone https://github.com/smsapi/smsapi-python-client.git
cd smsapi-python
python setup.py install
If You are smsapi.pl customer You should import
from smsapi.client import SmsApiPlClient
else You need to use client for smsapi.com
from smsapi.client import SmsApiComClient
from smsapi.client import SmsApiPlClient
token = "XXXX"
client = SmsApiPlClient(access_token=token)
from smsapi.client import SmsApiPlClient
token = "XXXX"
client = SmsApiPlClient(access_token=token)
send_results = client.sms.send(to="phone number", message="text message")
for result in send_results:
print(result.id, result.points, result.error)
- You can find more examples in "examples" directory in project files.
from smsapi.client import SmsApiPlClient
from smsapi.exception import SmsApiException
token = "XXXX"
client = SmsApiPlClient(access_token=token)
try:
contact = client.sms.send(to="123123")
except SmsApiException as e:
print(e.message, e.code)