mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-05 02:41:14 -05:00
DRY-up overriding shortcode with sender
This avoids duplicating the logic when we add a new provider.
This commit is contained in:
@@ -23,6 +23,7 @@ class SmsClient(Client):
|
||||
def init_app(self, current_app, statsd_client):
|
||||
self.current_app = current_app
|
||||
self.statsd_client = statsd_client
|
||||
self.from_number = self.current_app.config.get('FROM_NUMBER')
|
||||
|
||||
def record_outcome(self, success):
|
||||
log_message = "Provider request for {} {}".format(
|
||||
@@ -39,6 +40,7 @@ class SmsClient(Client):
|
||||
|
||||
def send_sms(self, to, content, reference, international, sender=None):
|
||||
start_time = monotonic()
|
||||
sender = self.from_number if sender is None else sender
|
||||
|
||||
try:
|
||||
response = self.try_send_sms(to, content, reference, international, sender)
|
||||
|
||||
Reference in New Issue
Block a user