def encoder(self, query: Dict[str, Any]):
        """编码请求为bytes.

        检查是否使用debug模式和是否对数据进行压缩.之后根据状态将python字典形式的请求编码为字节串.

        Parameters:

            query (Dict[str, Any]): - python字典形式的请求数据

        Return:

            (bytes): - 请求的字节串

        """
        if self.debug is True:
            queryb = json.dumps(
                query,
                ensure_ascii=False).encode("utf-8")
        else:
            queryb = msgpack.packb(query)

        if self.compreser:
            queryb = self.compreser.compress(queryb)

        return queryb + self.SEPARATOR
def encoder ( self , query : Dict [ str , Any ] ) : if self . debug is True : queryb = json . dumps ( query , ensure_ascii = False ) . encode ( "utf-8" ) else : queryb = msgpack . packb ( query ) if self . compreser : queryb = self . compreser . compress ( queryb ) return queryb + self . SEPARATOR
编码请求为bytes.

        检查是否使用debug模式和是否对数据进行压缩.之后根据状态将python字典形式的请求编码为字节串.

        Parameters:

            query (Dict[str, Any]): - python字典形式的请求数据

        Return:

            (bytes): - 请求的字节串