Added multi parameter for sending messages.

This commit is contained in:
Nicholas Staples
2016-04-18 09:55:56 +01:00
parent a96d2b5e4a
commit 15c4fb47f7

View File

@@ -1,3 +1,4 @@
import json
from flask import current_app from flask import current_app
from monotonic import monotonic from monotonic import monotonic
from requests import (request, RequestException, HTTPError) from requests import (request, RequestException, HTTPError)
@@ -47,18 +48,18 @@ class MMGClient(SmsClient):
def get_name(self): def get_name(self):
return self.name return self.name
def send_sms(self, to, content, reference): def send_sms(self, to, content, reference, multi=True):
data = { data = {
"reqType": "BULK", "reqType": "BULK",
"MSISDN": to, "MSISDN": to,
"msg": content, "msg": content,
"sender": self.from_number, "sender": self.from_number,
"cid": reference "cid": reference,
"multi": multi
} }
start_time = monotonic() start_time = monotonic()
try: try:
import json
response = request("POST", "https://www.mmgrp.co.uk/API/json/api.php", response = request("POST", "https://www.mmgrp.co.uk/API/json/api.php",
data=json.dumps(data), data=json.dumps(data),
headers={'Content-Type': 'application/json', headers={'Content-Type': 'application/json',