Celery task to send the sms verify code.

Each celery task will use it's own queue.
This commit is contained in:
Rebecca Law
2016-02-17 15:41:33 +00:00
parent d6bea65626
commit d022d036dc
7 changed files with 57 additions and 18 deletions

View File

@@ -30,3 +30,13 @@ def send_sms(service_id, notification_id, encrypted_notification):
except SQLAlchemyError as e:
current_app.logger.debug(e)
@notify_celery.task(name='send-sms-code')
def send_sms_code(encrypted_notification):
notification = encryption.decrypt(encrypted_notification)
try:
twilio_client.send_sms(notification['to'], notification['secret_code'])
except TwilioClientException as e:
current_app.logger.debug(e)