Added in publish by phone number

This commit is contained in:
Terry Cain 2017-09-26 00:21:07 +01:00
commit 56c65bc67c
No known key found for this signature in database
GPG key ID: 14D90844E4E9B9F3
5 changed files with 121 additions and 1 deletions

View file

@ -221,6 +221,12 @@ class SNSBackend(BaseBackend):
except KeyError:
raise SNSNotFoundError("Topic with arn {0} not found".format(arn))
def get_topic_from_phone_number(self, number):
for subscription in self.subscriptions.values():
if subscription.protocol == 'sms' and subscription.endpoint == number:
return subscription.topic.arn
raise SNSNotFoundError('Could not find valid subscription')
def set_topic_attribute(self, topic_arn, attribute_name, attribute_value):
topic = self.get_topic(topic_arn)
setattr(topic, attribute_name, attribute_value)