envelope.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:data_pipeline 作者: Yelp 项目源码 文件源码
def unpack(self, packed_message):
        """Decodes a message packed with :func:`pack`.

        Warning:
            The public API for this function may change to return
            :class:`data_pipeline.message.Message` instances.

        Args:
            packed_message (bytes): The previously packed message

        Returns:
            dict: A dictionary with the decoded Avro representation.
        """

        # If the magic byte is ASCII_MAGIC_BYTE, decode it from base64 to ASCII
        if packed_message[0] == self.ASCII_MAGIC_BYTE:
            packed_message = base64.urlsafe_b64decode(packed_message[1:])

        return self._avro_string_reader.decode(packed_message[1:])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号