Skip to content

Repository files navigation

smsapi-python

Build StatusPyPI

Client for SMSAPI.

COMPATIBILITY

Compatible with Python 2.7+, 3.+.

REQUIREMENTS

requests

INSTALLATION

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

Client instance

If You are smsapi.pl customer You should import

fromsmsapi.clientimportSmsApiPlClient

else You need to use client for smsapi.com

fromsmsapi.clientimportSmsApiComClient

Credentials

Access Token

fromsmsapi.clientimportSmsApiPlClienttoken="XXXX"client=SmsApiPlClient(access_token=token)

Examples

Send SMS

fromsmsapi.clientimportSmsApiPlClienttoken="XXXX"client=SmsApiPlClient(access_token=token)
send_results=client.sms.send(to="phone number", message="text message")
forresultinsend_results:
print(result.id, result.points, result.error)
  • You can find more examples in "examples" directory in project files.

Error handling

fromsmsapi.clientimportSmsApiPlClientfromsmsapi.exceptionimportSmsApiExceptiontoken="XXXX"client=SmsApiPlClient(access_token=token)
try:
contact=client.sms.send(to="123123")
exceptSmsApiExceptionase:
print(e.message, e.code)

LICENSE

Apache 2.0 License

About

SMSAPI Python client that allows you to send messages, manage Short URLs and administrate your SMSAPI account.

Resources

Stars

58 stars

Watchers

10 watching

Forks

Releases

Packages

Used by

Contributors

Languages