messages/api.py
def message_factory(msg_type, msg_types=MESSAGE_TYPES, *args, **kwargs):
    """
    Factory function to return the specified message instance.

    Args:
        :msg_type: (str) the type of message to send, i.e. 'Email'
        :msg_types: (str, list, or set) the supported message types
        :kwargs: (dict) keywords arguments that are required for the
            various message types.  See docstrings for each type.
            i.e. help(messages.Email), help(messages.Twilio), etc.
    """
    try:
        return msg_types[msg_type.lower()](*args, **kwargs)
    except (UnknownProfileError, InvalidMessageInputError) as e:
        err_exit("Unable to send message: ", e)
    except KeyError:
        raise UnsupportedMessageTypeError(msg_type, msg_types)
def message_factory(msg_type, msg_types=MESSAGE_TYPES, *args, **kwargs):
    try:
        return msg_types[msg_type.lower()](*args, **kwargs)
    except (UnknownProfileError, InvalidMessageInputError) as e:
        err_exit("Unable to send message: ", e)
    except KeyError:
        raise UnsupportedMessageTypeError(msg_type, msg_types)
def message_factory ( msg_type , msg_types = MESSAGE_TYPES , * args , * * kwargs ) : try : return msg_types [ msg_type . lower ( ) ] ( * args , * * kwargs ) except ( UnknownProfileError , InvalidMessageInputError ) as e : err_exit ( "Unable to send message: " , e ) except KeyError : raise UnsupportedMessageTypeError ( msg_type , msg_types )
Factory function to return the specified message instance.

    Args:
        :msg_type: (str) the type of message to send, i.e. 'Email'
        :msg_types: (str, list, or set) the supported message types
        :kwargs: (dict) keywords arguments that are required for the
            various message types.  See docstrings for each type.
            i.e. help(messages.Email), help(messages.Twilio), etc.
Factory function to return the specified message instance .