MCPcopy Create free account
hub / github.com/doraemonext/wechat-python-sdk / response_text

Method response_text

wechat_sdk/basic.py:207–224  ·  view source on GitHub ↗

将文字信息 content 组装为符合微信服务器要求的响应数据 :param content: 回复文字 :param escape: 是否转义该文本内容 (默认不转义) :return: 符合微信服务器要求的 XML 响应数据

(self, content, escape=False)

Source from the content-addressed store, hash-verified

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 """

Callers 2

test_response_textMethod · 0.95

Calls 5

_check_parseMethod · 0.95
_encrypt_responseMethod · 0.95
TextReplyClass · 0.85
_transcodingMethod · 0.80
renderMethod · 0.45

Tested by 1

test_response_textMethod · 0.76