def find_contact(self, account_key, msisdn): contact_store = ContactStore( self.dispatcher.vumi_api.manager, account_key) try: contact = yield contact_store.contact_for_addr('ussd', msisdn) returnValue(contact) except ContactError: returnValue(None)
def __init__(self, api, user_account_key): # We could get either bytes or unicode here. Decode if necessary. if not isinstance(user_account_key, unicode): user_account_key = user_account_key.decode('utf8') self.api = api self.manager = self.api.manager self.user_account_key = user_account_key self.conversation_store = ConversationStore(self.api.manager, self.user_account_key) self.contact_store = ContactStore(self.api.manager, self.user_account_key) self.router_store = RouterStore(self.api.manager, self.user_account_key) self.channel_store = ChannelStore(self.api.manager, self.user_account_key) self.optout_store = OptOutStore(self.api.manager, self.user_account_key)