wechat/crypt.py
def extract(self, xmltext):
        """提取出xml数据包中的加密消息
        @param xmltext: 待提取的xml字符串
        @return: 提取出的加密消息字符串
        """
        try:
            xml_tree = ET.fromstring(xmltext)
            encrypt = xml_tree.find("Encrypt")
            touser_name = xml_tree.find("ToUserName")
            if touser_name != None:
                touser_name = touser_name.text
            return WXBizMsgCrypt_OK, encrypt.text, touser_name
        except Exception:
            return WXBizMsgCrypt_ParseXml_Error, None, None
def extract(self, xmltext):
        """提取出xml数据包中的加密消息
        @param xmltext: 待提取的xml字符串
        @return: 提取出的加密消息字符串
        """
        try:
            xml_tree = ET.fromstring(xmltext)
            encrypt = xml_tree.find("Encrypt")
            touser_name = xml_tree.find("ToUserName")
            if touser_name != None:
                touser_name = touser_name.text
            return WXBizMsgCrypt_OK, encrypt.text, touser_name
        except Exception:
            return WXBizMsgCrypt_ParseXml_Error, None, None
def extract ( self , xmltext ) : try : xml_tree = ET . fromstring ( xmltext ) encrypt = xml_tree . find ( "Encrypt" ) touser_name = xml_tree . find ( "ToUserName" ) if touser_name != None : touser_name = touser_name . text return WXBizMsgCrypt_OK , encrypt . text , touser_name except Exception : return WXBizMsgCrypt_ParseXml_Error , None , None
提取出xml数据包中的加密消息
        @param xmltext: 待提取的xml字符串
        @return: 提取出的加密消息字符串
提取出xml数据包中的加密消息