
Sample Code Phyton - HTTPs
# -*- coding: utf-8 -*-
"""This module send a SMS to one or more recipients"""
import json
import requests
import time
auth_headers = {'Accept': 'application/json'}
auth_payload = {
"grant_type": "password",
"userName": "******",
"password": "*******"
}
r = requests.post("https://apiv2.suresms.com/json/token", data=auth_payload, headers=auth_headers)
auth_response = json.loads(r.text)
time.sleep(1)
print "Sender en SMS!"
payload = {
"MessageID": "etId",
"MessageText": "Test fredag den 3. November. Nu er det J-dag",
"ToPhoneNumbers": "4520xxxx;4529xxxx",
"SenderID": "Allerup",
"SendAsFlash": False,
"HasCallBackURL": "",
"RequiredDeliveryUTCDateTime": "2017-11-03T09:06:00.810Z",
"ScheduleDaily": False,
"ScheduleDailyExceptWeekend": False,
"ScheduleWeekly": False,
"ScheduleMonthly": False,
"ScheduleYearly": False}
headers = {'Authorization': 'Bearer ' + str(auth_response["access_token"])}
r = requests.post("https://apiv2.suresms.com/json/api/Message", data=payload, headers=headers)
print(r.text)