django_ses/utils.py
def _get_bytes_to_sign(self):
        """
        Creates the message used for signing SNS notifications.
        This is used to verify the bounce message when it is received.
        """

        # Depending on the message type the fields to add to the message
        # differ so we handle that here.
        msg_type = self._data.get('Type')
        if msg_type == 'Notification':
            fields_to_sign = [
                'Message',
                'MessageId',
                'Subject',
                'Timestamp',
                'TopicArn',
                'Type',
            ]
        elif (msg_type == 'SubscriptionConfirmation' or
              msg_type == 'UnsubscribeConfirmation'):
            fields_to_sign = [
                'Message',
                'MessageId',
                'SubscribeURL',
                'Timestamp',
                'Token',
                'TopicArn',
                'Type',
            ]
        else:
            # Unrecognized type
            logger.warning('Unrecognized SNS message Type: "%s"', msg_type)
            return None

        bytes_to_sign = []
        for field in fields_to_sign:
            field_value = self._data.get(field)
            if field_value:
                # Some notification types do not have all fields. Only add
                # fields with values.
                bytes_to_sign.append(f"{field}\n{field_value}\n")

        return "".join(bytes_to_sign).encode()

        Creates the message used for signing SNS notifications.
        This is used to verify the bounce message when it is received.
        
Creates the message used for signing SNS notifications.
This is used to verify the bounce message when it is received.
Creates the message used for signing SNS notifications . This is used to verify the bounce message when it is received .
def _get_bytes_to_sign(self):
        msg_type = self._data.get('Type')
        if msg_type == 'Notification':
            fields_to_sign = [
                'Message',
                'MessageId',
                'Subject',
                'Timestamp',
                'TopicArn',
                'Type',
            ]
        elif (msg_type == 'SubscriptionConfirmation' or
              msg_type == 'UnsubscribeConfirmation'):
            fields_to_sign = [
                'Message',
                'MessageId',
                'SubscribeURL',
                'Timestamp',
                'Token',
                'TopicArn',
                'Type',
            ]
        else:
            logger.warning('Unrecognized SNS message Type: "%s"', msg_type)
            return None
        bytes_to_sign = []
        for field in fields_to_sign:
            field_value = self._data.get(field)
            if field_value:
                bytes_to_sign.append(f"{field}\n{field_value}\n")
        return "".join(bytes_to_sign).encode()
def _get_bytes_to_sign ( self ) : msg_type = self . _data . get ( 'Type' ) if msg_type == 'Notification' : fields_to_sign = [ 'Message' , 'MessageId' , 'Subject' , 'Timestamp' , 'TopicArn' , 'Type' , ] elif ( msg_type == 'SubscriptionConfirmation' or msg_type == 'UnsubscribeConfirmation' ) : fields_to_sign = [ 'Message' , 'MessageId' , 'SubscribeURL' , 'Timestamp' , 'Token' , 'TopicArn' , 'Type' , ] else : logger . warning ( 'Unrecognized SNS message Type: "%s"' , msg_type ) return None bytes_to_sign = [ ] for field in fields_to_sign : field_value = self . _data . get ( field ) if field_value : bytes_to_sign . append ( f"{field}\n{field_value}\n" ) return "" . join ( bytes_to_sign ) . encode ( )
Creates the message used for signing SNS notifications.
Creates the message used for signing SNS notifications .
"""
        Creates the message used for signing SNS notifications.
        This is used to verify the bounce message when it is received.
        """ # Depending on the message type the fields to add to the message # differ so we handle that here. # Unrecognized type # Some notification types do not have all fields. Only add # fields with values.
self