mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 06:52:06 -05:00
Update mmg send_sms to include cid and request headers
Use mmg to send_sms
This commit is contained in:
@@ -320,7 +320,7 @@ def send_sms_code(encrypted_verification):
|
||||
mmg_client.send_sms(validate_and_format_phone_number(verification_message['to']),
|
||||
verification_message['secret_code'],
|
||||
'send-sms-code')
|
||||
except Exception as e:
|
||||
except MMGClientException as e:
|
||||
current_app.logger.exception(e)
|
||||
|
||||
|
||||
|
||||
@@ -52,16 +52,20 @@ class MMGClient(SmsClient):
|
||||
"reqType": "BULK",
|
||||
"MSISDN": to,
|
||||
"msg": content,
|
||||
"sender": self.from_number
|
||||
"sender": self.from_number,
|
||||
"cid": reference
|
||||
}
|
||||
|
||||
start_time = monotonic()
|
||||
try:
|
||||
import json
|
||||
response = request("POST", "https://www.mmgrp.co.uk/API/json/api.php",
|
||||
data=data)
|
||||
data=json.dumps(data),
|
||||
headers={'Content-Type': 'application/json',
|
||||
'Authorization': 'Basic {}'.format(self.api_key)})
|
||||
if response.status_code != 200:
|
||||
error = response.json
|
||||
raise MMGClientException(error)
|
||||
error = response.text
|
||||
raise MMGClientException(json.loads(error))
|
||||
response.raise_for_status()
|
||||
except RequestException as e:
|
||||
api_error = HTTPError.create(e)
|
||||
|
||||
Reference in New Issue
Block a user