将文字信息 content 组装为符合微信服务器要求的响应数据 :param content: 回复文字 :param escape: 是否转义该文本内容 (默认不转义) :return: 符合微信服务器要求的 XML 响应数据
(self, content, escape=False)
| 205 | return self._encrypt_response('success') |
| 206 | |
| 207 | def response_text(self, content, escape=False): |
| 208 | """ |
| 209 | 将文字信息 content 组装为符合微信服务器要求的响应数据 |
| 210 | :param content: 回复文字 |
| 211 | :param escape: 是否转义该文本内容 (默认不转义) |
| 212 | :return: 符合微信服务器要求的 XML 响应数据 |
| 213 | """ |
| 214 | self._check_parse() |
| 215 | content = self._transcoding(content) |
| 216 | if escape: |
| 217 | if six.PY2: |
| 218 | content = cgi.escape(content) |
| 219 | else: |
| 220 | import html |
| 221 | content = html.escape(content) |
| 222 | |
| 223 | response = TextReply(message=self.__message, content=content).render() |
| 224 | return self._encrypt_response(response) |
| 225 | |
| 226 | def response_image(self, media_id): |
| 227 | """ |