Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- # Отправка SMS на чистом Python через sms-шлюз SMSPILOT.RU
- import requests
- import xml.etree.ElementTree as ET
- import urllib
- import json
- import re
- def run(event, context):
- user = json.loads(event['body']['user'])
- event = json.loads(event['body']['event'])
- userid = str(user['id'])
- phone = str(user['props'].get('$phone', ''))
- phoneFormat = re.sub("\D", "", phone) # номер телефона в международном формате
- text = 'Спасибо за обращение в СанСочи! Совсем скоро мы перезвоним вам!'; # текст сообщения
- sender = 'INFORM'; # имя отправителя из списка https://www.smspilot.ru/my-sender.php
- # !!! Замените API-ключ на свой https://www.smspilot.ru/my-settings.php#api
- apikey = '08P1PYH5AMMLVZK9V88B7JVA331MWA4Y4Y8RC7P79PG3BR00574Z611KS946A8KE';
- #url = "http://smspilot.ru/api.php?send=%s&to=%s&from=%s&apikey=%s&format=json" % (text, phoneFormat, sender, apikey )
- r = requests.post("http://smspilot.ru/api.php?send=" + text + "&to=" +str(phoneFormat) + "&from=" + sender + "&apikey=" + apikey + "&format=json")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement