将新闻信息组装为符合微信服务器要求的响应数据 :param articles: list 对象, 每个元素为一个 dict 对象, key 包含 `title`, `description`, `picurl`, `url` :return: 符合微信服务器要求的 XML 响应数据
(self, articles)
| 281 | return self._encrypt_response(response) |
| 282 | |
| 283 | def response_news(self, articles): |
| 284 | """ |
| 285 | 将新闻信息组装为符合微信服务器要求的响应数据 |
| 286 | :param articles: list 对象, 每个元素为一个 dict 对象, key 包含 `title`, `description`, `picurl`, `url` |
| 287 | :return: 符合微信服务器要求的 XML 响应数据 |
| 288 | """ |
| 289 | self._check_parse() |
| 290 | for article in articles: |
| 291 | if article.get('title'): |
| 292 | article['title'] = self._transcoding(article['title']) |
| 293 | if article.get('description'): |
| 294 | article['description'] = self._transcoding(article['description']) |
| 295 | if article.get('picurl'): |
| 296 | article['picurl'] = self._transcoding(article['picurl']) |
| 297 | if article.get('url'): |
| 298 | article['url'] = self._transcoding(article['url']) |
| 299 | |
| 300 | news = ArticleReply(message=self.__message) |
| 301 | for article in articles: |
| 302 | article = Article(**article) |
| 303 | news.add_article(article) |
| 304 | response = news.render() |
| 305 | return self._encrypt_response(response) |
| 306 | |
| 307 | def group_transfer_message(self): |
| 308 | """ |