Example #1
0
    def encode(self):
        """ Create a properly formatted message as a string. """
        header_str = self.header.encode()

        payloads_str = _encode([x.encode() for x in self.payloads], PAYLOAD_SEP_DELIM_INDEX)

        checksum = str(crc32(payloads_str))

        return _encode([header_str, payloads_str, checksum], ROOT_DELIM_INDEX)
Example #2
0
 def encode(self):
     """ Created a properly formatted header as a string. """
     return _encode(self._convert_to_list(), HEADER_ROOT_DELIM_INDEX)
Example #3
0
 def encode(self):
     """ Created a properly formatted payload as a string. """
     to_encode = self._convert_to_list()
     return _encode(to_encode, PAYLOAD_ROOT_DELIM_INDEX)