Tell me, please, how to implement sending a large number of messages on python.

To send an SMS, call the POST address method:

https://api.smsworldhub.com/v1/send/multi?token={token} 

Description of the parameters transmitted to the Server:

Main settings:

 GET token Ваш token из профиля. POST messages Отправьте массив с данными: - phone - mes Max 20000 items 

Extra options:

 POST lifeTime Срок жизни SMS 1 - 24 ч. POST costUsd Максимальная цена $ за sms. POST costRur Максимальная цена руб. за sms. 

Codes:

 200 Успешный запрос 400 Ошибка валидации 403 Нет прав 

In case of a successful request, the Server returns the response as a string:

 {"status":"OK","code":200,"data":{"count":20000}} 

Those. just get for balance request goes bang

 import requests my_token = "17982......................." get_url = "https://api.smsworldhub.com/v1/balance?token=%s" % my_token" r = requests.get(rurl) print(r.content) 

And here is how to POST with an array of numbers and messages to send correctly. At random did not master.

1 answer 1

I suspect so

 import requests my_token = "17982......................." url = "https://api.smsworldhub.com/v1/send/multi?token=%s" % my_token message_text = 'Hello!' phones = ['+79990000001', '+79990000002', '+79990000003'] messages = ({'phone': phone, 'mes': message_text} for phone in phones) r = requests.post(url, data = {'messages': messages}) print(r.content)