Пример работы с SMS шлюзом на языке Python
Отправка смс
Получения статуса отправленной смс
Получение цены отправки
Получение баланса
Отправка смс:
login = ""
password = ""
phone_sms = "380633333131"
msg_id = "123456"
send_sms = '''<?xml version="1.0" encoding="UTF-8"?>
<SMS>
<operations>
<operation>SEND</operation>
</operations>
<authentification>
<username>%s</username>
<password>%s</password>
</authentification>
<message>
<sender>SMS</sender>
<text>Test message [UTF-8]</text>
</message>
<numbers>
<number messageID="%s">%s</number>
</numbers>
</SMS>''' % (login, password, msg_id, phone_sms)
import urllib2, urllib
senddata=[('XML',send_sms)]
senddata=urllib.urlencode(senddata)
path='http://api.myatompark.com/members/sms/xml.php'
req=urllib2.Request(path, senddata)
req.add_header("Content-type", "application/x-www-form-urlencoded")
result=urllib2.urlopen(req).read()
print result
Получения статуса отправленной смс*:
login = ""
password = ""
phone_sms = "380633333131"
msg_id = "123456"
get_sms_status = '''<?xml version="1.0" encoding="UTF-8"?>
<SMS>
<operations>
<operation>GETPRICE</operation>
</operations>
<authentification>
<username>%s</username>
<password>%s</password>
</authentification>
<message>
<sender>SMS</sender>
<text>Test message [UTF-8]</text>
</message>
<numbers>
<number messageID="%s">%s</number>
</numbers>
</SMS>''' % (login, password, msg_id, phone_sms)
import urllib2, urllib
senddata=[('XML',get_sms_status)]
senddata=urllib.urlencode(senddata)
path='http://api.myatompark.com/members/sms/xml.php'
req=urllib2.Request(path, senddata)
req.add_header("Content-type", "application/x-www-form-urlencoded")
result=urllib2.urlopen(req).read()
print result
* Информация о статусе смс будет доступна спустя несколько минут после отправки
Получение цены отправки:
login = ""
password = ""
phone_sms = "380633333131"
msg_id = "123456"
get_send_price = '''<?xml version="1.0" encoding="UTF-8"?>
<SMS>
<operations>
<operation>GETPRICE</operation>
</operations>
<authentification>
<username>%s</username>
<password>%s</password>
</authentification>
<message>
<sender>SMS</sender>
<text>Test message [UTF-8]</text>
</message>
<numbers>
<number messageID="%s">%s</number>
</numbers>
</SMS>''' % (login, password, msg_id, phone_sms)
import urllib2, urllib
senddata=[('XML',get_send_price)]
senddata=urllib.urlencode(senddata)
path='http://api.myatompark.com/members/sms/xml.php'
req=urllib2.Request(path, senddata)
req.add_header("Content-type", "application/x-www-form-urlencoded")
result=urllib2.urlopen(req).read()
print result
Получение баланса
login = ""
password = ""
phone_sms = "380633333131"
msg_id = "123456"
get_balance = '''<?xml version="1.0" encoding="UTF-8"?>
<SMS>
<operations>
<operation>BALANCE</operation>
</operations>
<authentification>
<username>%s</username>
<password>%s</password>
</authentification>
</SMS>''' % (login, password)
import urllib2, urllib
senddata=[('XML',get_balance)]
senddata=urllib.urlencode(senddata)
path='http://api.myatompark.com/members/sms/xml.php'
req=urllib2.Request(path, senddata)
req.add_header("Content-type", "application/x-www-form-urlencoded")
result=urllib2.urlopen(req).read()
print result
По запросу предоставляется необходимое количество дополнительных смс для тестирования сервиса массовых смс-уведомлений ePochta SMS.
Есть вопрос?
- 8 (800) 555-09-63
- Бесплатно по России
Новости:
- 2020-11-27
- Внимание! С 1 декабря 2020 года меняется цена на отправку СМС в сети Билайн
- 2020-11-23
- ePochta объявляет старт Черной Пятницы: Спеццена на рассылку в WhatsApp
- 2020-11-18
- С 1 декабря 2020 года оператор МТС повышает стоимость СМС
- 2020-05-04
- Вебинар: СМС маркетинг. Что писать в тексте СМС рассылок?
- 2020-04-28
- Операторы повышают цены СМС рассылки по прямому каналу в РФ


7 (495) 649-62-48
Украинский
Казахский
English
Italiano
