Skip to main content

Python SMSPilot API

Project description

Upload Python Package

SmsPilotPy

Не официальный клиент API проекта SMSPilot

https://smspilot.ru/

Установка

pip install sms-pilot-py

Пример использования

from sms_pilot import SmsPilot

API_KEY = 'XXXXXXXXXXXXYYYYYYYYYYYYZZZZZZZZXXXXXXXXXXXXYYYYYYYYYYYYZZZZZZZZ'

api = SmsPilot(API_KEY, default_sender='INFORM')

result = api.send_message(79201112223, 'Привет, мир!')
print(result.status, result.get_status_verbose()) 
print(result.cost)

# Запрос PING
ping_response = api.ping(79201112223)
# time.sleep(10)
ping_result = api.check_ping_hlr(ping_response.server_id)

if ping_result.is_ot_of_service():
    print('Не обслуживается')

Отправка нескольких сообщений

from sms_pilot import SmsPilot
from sms_pilot import Callback

API_KEY = 'XXXXXXXXXXXXYYYYYYYYYYYYZZZZZZZZXXXXXXXXXXXXYYYYYYYYYYYYZZZZZZZZ'

api = SmsPilot(API_KEY, default_sender='INFORM')

api.add_message(79221112233, 'Hello')
api.add_message(79221112222, 'Привет', sender='MYSENDER')
api.add_message(79122334434, 'Привет мир', id=455, callback=Callback('https://smspilot.ru/callback', 'POST'))
result = api.send_messages()

print(result.cost)

for msg_result in result.send:
    print(msg_result.status, msg_result.id)

Для использования требуется регистрация на https://smspilot.ru

Больше информации о API на http://www.smspilot.ru/apikey.php

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

sms-pilot-py-0.3.tar.gz (7.7 kB view hashes)

Uploaded Source

Built Distribution

sms_pilot_py-0.3-py3-none-any.whl (8.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page