__init__.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:rss_skill 作者: forslund 项目源码 文件源码
def handle_headlines(self, message):
        """Speak the latest headlines from the selected feed."""
        title = message.data['TitleKeyword']
        feed = feedparser.parse(self.feeds[title])
        items = feed.get('items', [])

        # Only read three items
        if len(items) > 3:
            items = items[:3]
        self.cache(title, items)

        self._is_reading_headlines = True
        self.speak('Here\'s the latest headlines from ' +
                   message.data['TitleKeyword'])
        for i in items:
            if not self._is_reading_headlines:
                break
            logger.info('Headline: ' + i['title'])
            self.speak(i['title'])
            time.sleep(5)
        self._is_reading_headlines = False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号