(message_info)
return aws_info
Creates a list of AwsMeta objects from the Message portion of an AWS
    SNS Notification message.
    :param message_info: (dict) the "Message" portion of an SNS notification
    :return: (list) AwsMeta objects
Creates a list of AwsMeta objects from the Message portion of an AWS
    SNS Notification message.
    :param message_info: (dict) the "Message" portion of an SNS notification
    :return: (list) AwsMeta objects
Creates a list of AwsMeta objects from the Message portion of an AWS SNS Notification message . : param message_info : ( dict ) the Message portion of an SNS notification : return : ( list ) AwsMeta objects
def get_relevant_aws_meta(message_info):
    """
    Creates a list of AwsMeta objects from the Message portion of an AWS
    SNS Notification message.
    :param message_info: (dict) the "Message" portion of an SNS notification
    :return: (list) AwsMeta objects
    """
    aws_info = []
    mail_info = message_info.get('mail', {})
    notification_type = message_info.get('notificationType') or message_info.get('eventType')
    if notification_type == NotificationType.BOUNCE:
        bounce_info = message_info['bounce']
        for recipient in bounce_info['bouncedRecipients']:
            aws_info.append(AwsMeta(
                notification_type=notification_type,
                main_type=bounce_info['bounceType'],
                sub_type=bounce_info['bounceSubType'],
                timestamp=parse_datetime(bounce_info['timestamp']),
                email=recipient['emailAddress'],
                reason=recipient.get('diagnosticCode'),
                headers=mail_info.get('commonHeaders', {}),
                destination=mail_info.get('destination', []),
            ))
    elif notification_type == NotificationType.COMPLAINT:
        complaint_info = message_info['complaint']
        for recipient in complaint_info['complainedRecipients']:
            aws_info.append(AwsMeta(
                notification_type=notification_type,
                main_type=message_info.get('complaintFeedbackType'),
                sub_type=complaint_info.get('complaintSubType'),
                timestamp=parse_datetime(complaint_info['timestamp']),
                email=recipient['emailAddress'],
                reason=None,
                headers=mail_info.get('commonHeaders', {}),
                destination=mail_info.get('destination', []),
            ))
    return aws_info
def get_relevant_aws_meta ( message_info ) : aws_info = [ ] mail_info = message_info . get ( 'mail' , { } ) notification_type = message_info . get ( 'notificationType' ) or message_info . get ( 'eventType' ) if notification_type == NotificationType . BOUNCE : bounce_info = message_info [ 'bounce' ] for recipient in bounce_info [ 'bouncedRecipients' ] : aws_info . append ( AwsMeta ( notification_type = notification_type , main_type = bounce_info [ 'bounceType' ] , sub_type = bounce_info [ 'bounceSubType' ] , timestamp = parse_datetime ( bounce_info [ 'timestamp' ] ) , email = recipient [ 'emailAddress' ] , reason = recipient . get ( 'diagnosticCode' ) , headers = mail_info . get ( 'commonHeaders' , { } ) , destination = mail_info . get ( 'destination' , [ ] ) , ) ) elif notification_type == NotificationType . COMPLAINT : complaint_info = message_info [ 'complaint' ] for recipient in complaint_info [ 'complainedRecipients' ] : aws_info . append ( AwsMeta ( notification_type = notification_type , main_type = message_info . get ( 'complaintFeedbackType' ) , sub_type = complaint_info . get ( 'complaintSubType' ) , timestamp = parse_datetime ( complaint_info [ 'timestamp' ] ) , email = recipient [ 'emailAddress' ] , reason = None , headers = mail_info . get ( 'commonHeaders' , { } ) , destination = mail_info . get ( 'destination' , [ ] ) , ) ) return aws_info