bot.py 文件源码

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

项目:votebot 作者: greut 项目源码 文件源码
def _listen(self):
        """Listen to the WebSocket URL."""
        with ClientSession() as session:
            ws = yield from session._ws_connect(self.rtm['url'])
            self.ws = ws
            try:
                while True:
                    msg = yield from ws.receive()
                    if msg.tp == MsgType.close:
                        break

                    assert msg.tp == MsgType.text
                    message = json.loads(msg.data)
                    yield from self.queue.put(message)
            finally:
                yield from ws.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号